Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[gherkin-cpp, message-cpp] does not work/compile with clang(-cl)//MSVC #191

Closed
daantimmer opened this issue Nov 13, 2023 · 3 comments
Closed

Comments

@daantimmer
Copy link

daantimmer commented Nov 13, 2023

πŸ‘“ What did you see?

Tried to compile for windows, using clang-cl and MSVC. Does not work, there are missing includes, incorrect includes, clang/gcc-only includes, incorrect template syntax etc.

βœ… What did you expect to see?

A working build

πŸ“¦ Which tool/library version are you using?

gherkin-cpp, current (first released).
clang-cl 15, clang-cl 16, MSVC 2019

πŸ”¬ How could we reproduce it?

I'll provide an example repo if this is being picked up

Steps to reproduce the behavior:

  1. Install '...' version '...'
  2. Create a file called '....'
  3. Run command '....'
  4. See error '....'

πŸ“š Any additional context?

Not much


This text was originally generated from a template, then edited by hand. You can modify the template here.

@chybz
Copy link
Contributor

chybz commented Nov 13, 2023

@daantimmer Could you please attach the original (as seen) errors ? "missing includes" is not very useful...
Thank you

@daantimmer daantimmer changed the title [gherkin-cpp] does not work/compile with clang-cl//MSVC [gherkin-cpp, message-cpp] does not work/compile with clang(-cl)//MSVC Nov 13, 2023
@daantimmer
Copy link
Author

daantimmer commented Nov 13, 2023

@chybz to continue from #192 here are my findings related to clang and clang-cl compilation failures:

As can be seen in this build results all clang(-cl) builds fail with multiple compilation issues: https://github.com/daantimmer/gherkin-cpp-container/actions/runs/6856150561

Changes required (on top of my other changes mentioned in #192):

Issues seen:

  • clang-cl: there is an implicit dependency on iostream in cucumber/messages. In clang and gcc iostream is probably included in one of the already included headers. This is not the case for the MSVC libraries
  • clang(-cl): the is_container_v custom type_trait doesn't compile for both clang and clang-cl. I've replaced it with a more verbose, but working example. It has to do with the fact that is_container_v has a template-template paramter of type template <typename> class C. But std::vector's template-template should look like template <typename, typename> class C because std::vector has an additional Alloc template
  • clang-cl: removed demangle.cpp/hpp. it simply doesn't compile because it uses gcc/clang compiler intrensics. Secondly it is not used at all. So it is deadcode.
  • clang-cl: MSVC's libraries are more verbose in terms of their iterators. The iterator from string_view doesn't return a const char *, but returns a custom iterator in the likes of string_view::iterator<const char>. This doesn't match with the template arguments for std::regex_match. Because it uses the common type of std::cmatch m and the iterators from string_view::begin()//end(). But it fails because they have no common type. (one is const char * and the other is aformentioned string_view::iterator. I've worked around this issue by dereferencing and then taking the address. I am not sure whether this is Undefined Behaviour, because we are dereferencing an invalid iterator returned by .end().

With all of these changes the build succeeds: https://github.com/daantimmer/gherkin-cpp-container/actions/runs/6856510747

@chybz
Copy link
Contributor

chybz commented Jan 18, 2024

Closing as work on #202 fixed the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants