jasonroelofs/rbgccxml

C++ STL of GCC 7.3 not understood

Closed this issue · 2 comments

Using Ruby 2.5.3p105 and rbgccxml 1.1.0, I get this error:

In file included from /tmp/header_wrapper20190121-15298-1sefoeb:1:
In file included from ../src/../src/server/server.h:4:
In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/7.3.0/../../../../include/c++/7.3.0/string:40:
In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/7.3.0/../../../../include/c++/7.3.0/bits/char_traits.h:39:
In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/7.3.0/../../../../include/c++/7.3.0/bits/stl_algobase.h:66:
/usr/bin/../lib/gcc/x86_64-linux-gnu/7.3.0/../../../../include/c++/7.3.0/bits/stl_iterator_base_funcs.h:87:7: error: statement not allowed in constexpr function
      while (__first != __last)
      ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/7.3.0/../../../../include/c++/7.3.0/bits/stl_iterator_base_funcs.h:147:5: error: constexpr function's return type 'void' is not a literal type
    __advance(_InputIterator& __i, _Distance __n, input_iterator_tag)
    ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/7.3.0/../../../../include/c++/7.3.0/bits/stl_iterator_base_funcs.h:158:5: error: constexpr function's return type 'void' is not a literal type
    __advance(_BidirectionalIterator& __i, _Distance __n,
    ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/7.3.0/../../../../include/c++/7.3.0/bits/stl_iterator_base_funcs.h:174:5: error: constexpr function's return type 'void' is not a literal type
    __advance(_RandomAccessIterator& __i, _Distance __n,
    ^
In file included from /tmp/header_wrapper20190121-15298-1sefoeb:1:
In file included from ../src/../src/server/server.h:4:
In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/7.3.0/../../../../include/c++/7.3.0/string:40:
/usr/bin/../lib/gcc/x86_64-linux-gnu/7.3.0/../../../../include/c++/7.3.0/bits/char_traits.h:96:7: error: constexpr function's return type 'void' is not a literal type
      assign(char_type& __c1, const char_type& __c2)
      ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/7.3.0/../../../../include/c++/7.3.0/bits/char_traits.h:151:7: error: statement not allowed in constexpr function
      for (std::size_t __i = 0; __i < __n; ++__i)
      ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/7.3.0/../../../../include/c++/7.3.0/bits/char_traits.h:165:7: error: statement not allowed in constexpr function
      while (!eq(__p[__i], char_type()))
      ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/7.3.0/../../../../include/c++/7.3.0/bits/char_traits.h:175:7: error: statement not allowed in constexpr function
      for (std::size_t __i = 0; __i < __n; ++__i)
      ^
8 errors generated.
rake aborted!
Error executing castxml command line: castxml -I../src -I../sdk/include -I../sdk/include/uabase -I../sdk/include/uaserver -I../sdk/include/uaclient -I../sdk/include/uapki -I../sdk/include/uastack -I../sdk/include/xmlparser -x c++ -fpermissive -std=c++11 -Wno-unused-command-line-argument --castxml-cc-gnu /usr/bin/clang++ --castxml-gccxml -o /tmp/rbgccxml20190121-15298-1vf7j0y /tmp/header_wrapper20190121-15298-1sefoeb
/home/p/.gem/ruby/2.5.3/gems/rbgccxml-1.1.0/lib/gccxml.rb:41:in `parse'
/home/p/.gem/ruby/2.5.3/gems/rbgccxml-1.1.0/lib/rbgccxml/parser.rb:63:in `parse'
/home/p/.gem/ruby/2.5.3/gems/rbgccxml-1.1.0/lib/rbgccxml/rbgccxml.rb:30:in `parse'
/home/p/.gem/ruby/2.5.3/gems/rbplusplus-1.4.0/lib/rbplusplus/extension.rb:171:in `sources'
build_extension.rb:19:in `block in <top (required)>'
/home/p/.gem/ruby/2.5.3/gems/rbplusplus-1.4.0/lib/rbplusplus/extension.rb:82:in `initialize'
build_extension.rb:16:in `new'
build_extension.rb:16:in `<top (required)>'
/home/p/mc/dev/opcua-src/Rakefile:31:in `load'
/home/p/mc/dev/opcua-src/Rakefile:31:in `block (2 levels) in <top (required)>'
/home/p/mc/dev/opcua-src/Rakefile:30:in `block in <top (required)>'
/home/p/.gem/ruby/2.5.3/gems/rake-12.1.0/exe/rake:27:in `<top (required)>'
/home/p/.gem/ruby/2.5.3/gems/bundler-1.17.1/lib/bundler/cli/exec.rb:74:in `load'
/home/p/.gem/ruby/2.5.3/gems/bundler-1.17.1/lib/bundler/cli/exec.rb:74:in `kernel_load'
/home/p/.gem/ruby/2.5.3/gems/bundler-1.17.1/lib/bundler/cli/exec.rb:28:in `run'
/home/p/.gem/ruby/2.5.3/gems/bundler-1.17.1/lib/bundler/cli.rb:463:in `exec'
/home/p/.gem/ruby/2.5.3/gems/bundler-1.17.1/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/home/p/.gem/ruby/2.5.3/gems/bundler-1.17.1/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
/home/p/.gem/ruby/2.5.3/gems/bundler-1.17.1/lib/bundler/vendor/thor/lib/thor.rb:387:in `dispatch'
/home/p/.gem/ruby/2.5.3/gems/bundler-1.17.1/lib/bundler/cli.rb:27:in `dispatch'
/home/p/.gem/ruby/2.5.3/gems/bundler-1.17.1/lib/bundler/vendor/thor/lib/thor/base.rb:466:in `start'
/home/p/.gem/ruby/2.5.3/gems/bundler-1.17.1/lib/bundler/cli.rb:18:in `start'
/home/p/.gem/ruby/2.5.3/gems/bundler-1.17.1/exe/bundle:30:in `block in <top (required)>'
/home/p/.gem/ruby/2.5.3/gems/bundler-1.17.1/lib/bundler/friendly_errors.rb:124:in `with_friendly_errors'
/home/p/.gem/ruby/2.5.3/gems/bundler-1.17.1/exe/bundle:22:in `<top (required)>'
/home/p/.gem/ruby/2.5.3/bin/bundle:23:in `load'
/home/p/.gem/ruby/2.5.3/bin/bundle:23:in `<main>'
Tasks: TOP => build_extension

Notice the command castxml -I../src -I../sdk/include -I../sdk/include/uabase -I../sdk/include/uaserver -I../sdk/include/uaclient -I../sdk/include/uapki -I../sdk/include/uastack -I../sdk/include/xmlparser -x c++ -fpermissive -std=c++11 -Wno-unused-command-line-argument --castxml-cc-gnu /usr/bin/clang++ --castxml-gccxml -o /tmp/rbgccxml20190121-15298-1vf7j0y /tmp/header_wrapper20190121-15298-1sefoeb. If I change GCCXML#parse to pass -std=c++14 instead of -std=c++11, the compilation succeeds.

That option could probably use a bump.

I haven't looked in a while, but do you know if there an option to always try to use the latest that the current compiler supports?

Thanks for the report, I'll take a look.

As far as I know, it’s not that easy. It’s about what standard (11, 14, 17, ...) you want to use for your source code while compiling.