cucumber/gherkin

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

daantimmer opened this issue ยท 3 comments

๐Ÿ‘“ 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 commented

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

@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

Closing as work on #202 fixed the issue