mattkretz / vir-simd

improve the usage experience of std::experimental::simd (Parallelism TS 2)
GNU Lesser General Public License v3.0
21 stars 2 forks source link

Compilation error with gcc10 on Debian11 #25

Closed fuhlig1 closed 2 weeks ago

fuhlig1 commented 3 months ago

When compiling the test suite on Debian11 with g++ (Debian 10.2.1-6) 10.2.1 20210110 I get the following error

CXX=g++ make 
gnu++20: test extensions (-Wall -Wextra -Wpedantic -Wno-attributes -Wno-unknown-pragmas -Wno-psabi -I/u/uhlig/vir-simd)
gnu++20: test extensions (-Wall -Wextra -Wpedantic -Wno-attributes -Wno-unknown-pragmas -Wno-psabi -I/u/uhlig/vir-simd -DVIR_DISABLE_STDX_SIMD)
gnu++2a: test constexpr_wrapper (-Wall -Wextra -Wpedantic -Wno-attributes -Wno-unknown-pragmas -Wno-psabi -I/u/uhlig/vir-simd)
In file included from vir/test_constexpr_wrapper.cpp:6:
vir/constexpr_wrapper.h: In substitution of ‘template<class Ap, class Bp>  requires (_lhs_constexpr_wrapper<Ap, vir::constexpr_wrapper<Xp, <template-parameter-1-2> > >) && (constexpr_value<Bp, void>) constexpr vir::constexpr_wrapper<(Ap::value + Bp::value), typename std::remove_cv<typename std::remove_reference<decltype ((Ap::value + Bp::value))>::type>::type> vir::operator+(Ap, Bp) [with Ap = vir::constexpr_wrapper<numarray<int, 4>{numarray<int, 4>::V{1, 2, 3, 4}}, numarray<int, 4> >; Bp = numarray<int, 4>]’:
vir/test_constexpr_wrapper.cpp:250:40:   required from here
vir/constexpr_wrapper.h:152:60: error: invalid use of non-static data member ‘numarray<int, 4>::value’
  152 |         friend constexpr constexpr_wrapper<Ap::value + Bp::value>
      |                                                            ^~~~~
vir/test_constexpr_wrapper.cpp:172:5: note: declared here
  172 |   V value;
      |     ^~~~~
In file included from vir/test_constexpr_wrapper.cpp:6:
vir/constexpr_wrapper.h: In substitution of ‘template<class Ap, class Bp>  requires (_lhs_constexpr_wrapper<Ap, vir::constexpr_wrapper<Xp, <template-parameter-1-2> > >) && (constexpr_value<Bp, void>) constexpr vir::constexpr_wrapper<(Ap::value == Bp::value), typename std::remove_cv<typename std::remove_reference<decltype ((Ap::value == Bp::value))>::type>::type> vir::operator==(Ap, Bp) [with Ap = vir::constexpr_wrapper<Test{1}, Test>; Bp = Test]’:
vir/test_constexpr_wrapper.cpp:120:21:   required from ‘void check(C) [with auto Expected = Test{1}; C = vir::constexpr_wrapper<Test{1}, Test>]’
vir/test_constexpr_wrapper.cpp:206:32:   required from here
vir/constexpr_wrapper.h:217:62: error: invalid use of non-static data member ‘Test::value’
  217 |         friend constexpr constexpr_wrapper<(Ap::value == Bp::value)>
      |                                                              ^~~~~
vir/test_constexpr_wrapper.cpp:29:7: note: declared here
   29 |   int value = 1;
      |       ^~~~~
In file included from vir/test_constexpr_wrapper.cpp:6:
vir/constexpr_wrapper.h: In substitution of ‘template<class Ap, class Bp>  requires (_lhs_constexpr_wrapper<Ap, vir::constexpr_wrapper<Xp, <template-parameter-1-2> > >) && (constexpr_value<Bp, void>) constexpr vir::constexpr_wrapper<(Ap::value == Bp::value), typename std::remove_cv<typename std::remove_reference<decltype ((Ap::value == Bp::value))>::type>::type> vir::operator==(Ap, Bp) [with Ap = Test; Bp = vir::constexpr_wrapper<Test{1}, Test>]’:
vir/test_constexpr_wrapper.cpp:120:21:   required from ‘void check(C) [with auto Expected = Test{1}; C = vir::constexpr_wrapper<Test{1}, Test>]’
vir/test_constexpr_wrapper.cpp:206:32:   required from here
vir/constexpr_wrapper.h:217:49: error: invalid use of non-static data member ‘Test::value’
  217 |         friend constexpr constexpr_wrapper<(Ap::value == Bp::value)>
      |                                                 ^~~~~
vir/test_constexpr_wrapper.cpp:29:7: note: declared here
   29 |   int value = 1;
      |       ^~~~~
vir/test_constexpr_wrapper.cpp: In instantiation of ‘void check(C) [with auto Expected = strlit<char, 4>{"fo"}; C = vir::constexpr_wrapper<strlit<char, 4>{"fo"}, strlit<char, 4> >]’:
vir/test_constexpr_wrapper.cpp:215:33:   required from here
vir/test_constexpr_wrapper.cpp:119:28: error: non-constant condition for static assertion
  119 |     static_assert(C::value == Expected);
      |                      ~~~~~~^~~~~~~~~~~
vir/test_constexpr_wrapper.cpp:119:28:   in ‘constexpr’ expansion of ‘vir::constexpr_wrapper<strlit<char, 4>{"fo"}, strlit<char, 4> >::value.strlit<char, 4>::operator==(strlit<char, 4>{"fo"})’
vir/test_constexpr_wrapper.cpp:66:5: error: ‘((& vir::constexpr_wrapper<strlit<char, 4>{"fo"}, strlit<char, 4> >::value) == (& strlit<char, 4>{"fo"}))’ is not a constant expression
   66 |     operator==(const strlit&) const = default;
      |     ^~~~~~~~
In file included from vir/test_constexpr_wrapper.cpp:6:
vir/constexpr_wrapper.h: In substitution of ‘template<class Ap, class Bp>  requires (_lhs_constexpr_wrapper<Ap, vir::constexpr_wrapper<Xp, <template-parameter-1-2> > >) && (constexpr_value<Bp, void>) constexpr vir::constexpr_wrapper<(Ap::value == Bp::value), typename std::remove_cv<typename std::remove_reference<decltype ((Ap::value == Bp::value))>::type>::type> vir::operator==(Ap, Bp) [with Ap = vir::constexpr_wrapper<strlit<char, 4>{"fo"}, strlit<char, 4> >; Bp = strlit<char, 4>]’:
vir/test_constexpr_wrapper.cpp:120:21:   required from ‘void check(C) [with auto Expected = strlit<char, 4>{"fo"}; C = vir::constexpr_wrapper<strlit<char, 4>{"fo"}, strlit<char, 4> >]’
vir/test_constexpr_wrapper.cpp:215:33:   required from here
vir/constexpr_wrapper.h:217:62: error: invalid use of non-static data member ‘strlit<char, 4>::value’
  217 |         friend constexpr constexpr_wrapper<(Ap::value == Bp::value)>
      |                                                              ^~~~~
vir/test_constexpr_wrapper.cpp:48:10: note: declared here
   48 |     Char value[size];
      |          ^~~~~
In file included from vir/test_constexpr_wrapper.cpp:6:
vir/constexpr_wrapper.h: In substitution of ‘template<class Ap, class Bp>  requires (_lhs_constexpr_wrapper<Ap, vir::constexpr_wrapper<Xp, <template-parameter-1-2> > >) && (constexpr_value<Bp, void>) constexpr vir::constexpr_wrapper<(Ap::value == Bp::value), typename std::remove_cv<typename std::remove_reference<decltype ((Ap::value == Bp::value))>::type>::type> vir::operator==(Ap, Bp) [with Ap = strlit<char, 4>; Bp = vir::constexpr_wrapper<strlit<char, 4>{"fo"}, strlit<char, 4> >]’:
vir/test_constexpr_wrapper.cpp:120:21:   required from ‘void check(C) [with auto Expected = strlit<char, 4>{"fo"}; C = vir::constexpr_wrapper<strlit<char, 4>{"fo"}, strlit<char, 4> >]’
vir/test_constexpr_wrapper.cpp:215:33:   required from here
vir/constexpr_wrapper.h:217:49: error: invalid use of non-static data member ‘strlit<char, 4>::value’
  217 |         friend constexpr constexpr_wrapper<(Ap::value == Bp::value)>
      |                                                 ^~~~~
vir/test_constexpr_wrapper.cpp:48:10: note: declared here
   48 |     Char value[size];
      |          ^~~~~
vir/test_constexpr_wrapper.cpp: In instantiation of ‘void check(C) [with auto Expected = strlit<char, 4>{"fo"}; C = vir::constexpr_wrapper<strlit<char, 4>{"fo"}, strlit<char, 4> >]’:
vir/test_constexpr_wrapper.cpp:215:33:   required from here
vir/test_constexpr_wrapper.cpp:120:21: error: static assertion failed
  120 |     static_assert(x == Expected);
      |                   ~~^~~~~~~~~~~
vir/test_constexpr_wrapper.cpp:121:27: error: non-constant condition for static assertion
  121 |     static_assert(x.value == Expected);
      |                   ~~~~~~~~^~~~~~~~~~~
vir/test_constexpr_wrapper.cpp:121:27:   in ‘constexpr’ expansion of ‘vir::constexpr_wrapper<strlit<char, 4>{"fo"}, strlit<char, 4> >::value.strlit<char, 4>::operator==(strlit<char, 4>{"fo"})’
vir/test_constexpr_wrapper.cpp:66:5: error: ‘((& vir::constexpr_wrapper<strlit<char, 4>{"fo"}, strlit<char, 4> >::value) == (& strlit<char, 4>{"fo"}))’ is not a constant expression
   66 |     operator==(const strlit&) const = default;
      |     ^~~~~~~~
vir/test_constexpr_wrapper.cpp: In instantiation of ‘void check(C) [with auto Expected = strlit<char, 7>{"fooba"}; C = vir::constexpr_wrapper<strlit<char, 7>{"fooba"}, strlit<char, 7> >]’:
vir/test_constexpr_wrapper.cpp:216:47:   required from here
vir/test_constexpr_wrapper.cpp:119:28: error: non-constant condition for static assertion
  119 |     static_assert(C::value == Expected);
      |                      ~~~~~~^~~~~~~~~~~
vir/test_constexpr_wrapper.cpp:119:28:   in ‘constexpr’ expansion of ‘vir::constexpr_wrapper<strlit<char, 7>{"fooba"}, strlit<char, 7> >::value.strlit<char, 7>::operator==(strlit<char, 7>{"fooba"})’
vir/test_constexpr_wrapper.cpp:66:5: error: ‘((& vir::constexpr_wrapper<strlit<char, 7>{"fooba"}, strlit<char, 7> >::value) == (& strlit<char, 7>{"fooba"}))’ is not a constant expression
   66 |     operator==(const strlit&) const = default;
      |     ^~~~~~~~
In file included from vir/test_constexpr_wrapper.cpp:6:
vir/constexpr_wrapper.h: In substitution of ‘template<class Ap, class Bp>  requires (_lhs_constexpr_wrapper<Ap, vir::constexpr_wrapper<Xp, <template-parameter-1-2> > >) && (constexpr_value<Bp, void>) constexpr vir::constexpr_wrapper<(Ap::value == Bp::value), typename std::remove_cv<typename std::remove_reference<decltype ((Ap::value == Bp::value))>::type>::type> vir::operator==(Ap, Bp) [with Ap = vir::constexpr_wrapper<strlit<char, 7>{"fooba"}, strlit<char, 7> >; Bp = strlit<char, 7>]’:
vir/test_constexpr_wrapper.cpp:120:21:   required from ‘void check(C) [with auto Expected = strlit<char, 7>{"fooba"}; C = vir::constexpr_wrapper<strlit<char, 7>{"fooba"}, strlit<char, 7> >]’
vir/test_constexpr_wrapper.cpp:216:47:   required from here
vir/constexpr_wrapper.h:217:62: error: invalid use of non-static data member ‘strlit<char, 7>::value’
  217 |         friend constexpr constexpr_wrapper<(Ap::value == Bp::value)>
      |                                                              ^~~~~
vir/test_constexpr_wrapper.cpp:48:10: note: declared here
   48 |     Char value[size];
      |          ^~~~~
In file included from vir/test_constexpr_wrapper.cpp:6:
vir/constexpr_wrapper.h: In substitution of ‘template<class Ap, class Bp>  requires (_lhs_constexpr_wrapper<Ap, vir::constexpr_wrapper<Xp, <template-parameter-1-2> > >) && (constexpr_value<Bp, void>) constexpr vir::constexpr_wrapper<(Ap::value == Bp::value), typename std::remove_cv<typename std::remove_reference<decltype ((Ap::value == Bp::value))>::type>::type> vir::operator==(Ap, Bp) [with Ap = strlit<char, 7>; Bp = vir::constexpr_wrapper<strlit<char, 7>{"fooba"}, strlit<char, 7> >]’:
vir/test_constexpr_wrapper.cpp:120:21:   required from ‘void check(C) [with auto Expected = strlit<char, 7>{"fooba"}; C = vir::constexpr_wrapper<strlit<char, 7>{"fooba"}, strlit<char, 7> >]’
vir/test_constexpr_wrapper.cpp:216:47:   required from here
vir/constexpr_wrapper.h:217:49: error: invalid use of non-static data member ‘strlit<char, 7>::value’
  217 |         friend constexpr constexpr_wrapper<(Ap::value == Bp::value)>
      |                                                 ^~~~~
vir/test_constexpr_wrapper.cpp:48:10: note: declared here
   48 |     Char value[size];
      |          ^~~~~
vir/test_constexpr_wrapper.cpp: In instantiation of ‘void check(C) [with auto Expected = strlit<char, 7>{"fooba"}; C = vir::constexpr_wrapper<strlit<char, 7>{"fooba"}, strlit<char, 7> >]’:
vir/test_constexpr_wrapper.cpp:216:47:   required from here
vir/test_constexpr_wrapper.cpp:120:21: error: static assertion failed
  120 |     static_assert(x == Expected);
      |                   ~~^~~~~~~~~~~
vir/test_constexpr_wrapper.cpp:121:27: error: non-constant condition for static assertion
  121 |     static_assert(x.value == Expected);
      |                   ~~~~~~~~^~~~~~~~~~~
vir/test_constexpr_wrapper.cpp:121:27:   in ‘constexpr’ expansion of ‘vir::constexpr_wrapper<strlit<char, 7>{"fooba"}, strlit<char, 7> >::value.strlit<char, 7>::operator==(strlit<char, 7>{"fooba"})’
vir/test_constexpr_wrapper.cpp:66:5: error: ‘((& vir::constexpr_wrapper<strlit<char, 7>{"fooba"}, strlit<char, 7> >::value) == (& strlit<char, 7>{"fooba"}))’ is not a constant expression
   66 |     operator==(const strlit&) const = default;
      |     ^~~~~~~~
vir/test_constexpr_wrapper.cpp: In instantiation of ‘void check(C) [with auto Expected = numarray<int, 4>{numarray<int, 4>::V{1, 2, 3, 4}}; C = vir::constexpr_wrapper<numarray<int, 4>{numarray<int, 4>::V{1, 2, 3, 4}}, numarray<int, 4> >]’:
vir/test_constexpr_wrapper.cpp:249:36:   required from here
vir/test_constexpr_wrapper.cpp:119:28: error: non-constant condition for static assertion
  119 |     static_assert(C::value == Expected);
      |                      ~~~~~~^~~~~~~~~~~
vir/test_constexpr_wrapper.cpp:119:28:   in ‘constexpr’ expansion of ‘operator==(vir::constexpr_wrapper<numarray<int, 4>{numarray<int, 4>::V{1, 2, 3, 4}}, numarray<int, 4> >::value, numarray<int, 4>{numarray<int, 4>::V{1, 2, 3, 4}})’
vir/test_constexpr_wrapper.cpp:189:3: error: ‘((& vir::constexpr_wrapper<numarray<int, 4>{numarray<int, 4>::V{1, 2, 3, 4}}, numarray<int, 4> >::value) == (& numarray<int, 4>{numarray<int, 4>::V{1, 2, 3, 4}}))’ is not a constant expression
  189 |   operator==(const numarray&, const numarray&) = default;
      |   ^~~~~~~~
In file included from vir/test_constexpr_wrapper.cpp:6:
vir/constexpr_wrapper.h: In substitution of ‘template<class Ap, class Bp>  requires (_lhs_constexpr_wrapper<Ap, vir::constexpr_wrapper<Xp, <template-parameter-1-2> > >) && (constexpr_value<Bp, void>) constexpr vir::constexpr_wrapper<(Ap::value == Bp::value), typename std::remove_cv<typename std::remove_reference<decltype ((Ap::value == Bp::value))>::type>::type> vir::operator==(Ap, Bp) [with Ap = vir::constexpr_wrapper<numarray<int, 4>{numarray<int, 4>::V{1, 2, 3, 4}}, numarray<int, 4> >; Bp = numarray<int, 4>]’:
vir/test_constexpr_wrapper.cpp:120:21:   required from ‘void check(C) [with auto Expected = numarray<int, 4>{numarray<int, 4>::V{1, 2, 3, 4}}; C = vir::constexpr_wrapper<numarray<int, 4>{numarray<int, 4>::V{1, 2, 3, 4}}, numarray<int, 4> >]’
vir/test_constexpr_wrapper.cpp:249:36:   required from here
vir/constexpr_wrapper.h:217:62: error: invalid use of non-static data member ‘numarray<int, 4>::value’
  217 |         friend constexpr constexpr_wrapper<(Ap::value == Bp::value)>
      |                                                              ^~~~~
vir/test_constexpr_wrapper.cpp:172:5: note: declared here
  172 |   V value;
      |     ^~~~~
In file included from vir/test_constexpr_wrapper.cpp:6:
vir/constexpr_wrapper.h: In substitution of ‘template<class Ap, class Bp>  requires (_lhs_constexpr_wrapper<Ap, vir::constexpr_wrapper<Xp, <template-parameter-1-2> > >) && (constexpr_value<Bp, void>) constexpr vir::constexpr_wrapper<(Ap::value == Bp::value), typename std::remove_cv<typename std::remove_reference<decltype ((Ap::value == Bp::value))>::type>::type> vir::operator==(Ap, Bp) [with Ap = numarray<int, 4>; Bp = vir::constexpr_wrapper<numarray<int, 4>{numarray<int, 4>::V{1, 2, 3, 4}}, numarray<int, 4> >]’:
vir/test_constexpr_wrapper.cpp:120:21:   required from ‘void check(C) [with auto Expected = numarray<int, 4>{numarray<int, 4>::V{1, 2, 3, 4}}; C = vir::constexpr_wrapper<numarray<int, 4>{numarray<int, 4>::V{1, 2, 3, 4}}, numarray<int, 4> >]’
vir/test_constexpr_wrapper.cpp:249:36:   required from here
vir/constexpr_wrapper.h:217:49: error: invalid use of non-static data member ‘numarray<int, 4>::value’
  217 |         friend constexpr constexpr_wrapper<(Ap::value == Bp::value)>
      |                                                 ^~~~~
vir/test_constexpr_wrapper.cpp:172:5: note: declared here
  172 |   V value;
      |     ^~~~~
vir/test_constexpr_wrapper.cpp: In instantiation of ‘void check(C) [with auto Expected = numarray<int, 4>{numarray<int, 4>::V{1, 2, 3, 4}}; C = vir::constexpr_wrapper<numarray<int, 4>{numarray<int, 4>::V{1, 2, 3, 4}}, numarray<int, 4> >]’:
vir/test_constexpr_wrapper.cpp:249:36:   required from here
vir/test_constexpr_wrapper.cpp:120:21: error: static assertion failed
  120 |     static_assert(x == Expected);
      |                   ~~^~~~~~~~~~~
vir/test_constexpr_wrapper.cpp:121:27: error: non-constant condition for static assertion
  121 |     static_assert(x.value == Expected);
      |                   ~~~~~~~~^~~~~~~~~~~
vir/test_constexpr_wrapper.cpp:121:27:   in ‘constexpr’ expansion of ‘operator==(vir::constexpr_wrapper<numarray<int, 4>{numarray<int, 4>::V{1, 2, 3, 4}}, numarray<int, 4> >::value, numarray<int, 4>{numarray<int, 4>::V{1, 2, 3, 4}})’
vir/test_constexpr_wrapper.cpp:189:3: error: ‘((& vir::constexpr_wrapper<numarray<int, 4>{numarray<int, 4>::V{1, 2, 3, 4}}, numarray<int, 4> >::value) == (& numarray<int, 4>{numarray<int, 4>::V{1, 2, 3, 4}}))’ is not a constant expression
  189 |   operator==(const numarray&, const numarray&) = default;
      |   ^~~~~~~~
mattkretz commented 3 months ago

vir/constexpr_wrapper.h:152:60: error: invalid use of non-static data member ‘numarray<int, 4>::value’

That's a bug in GCC 10's concept implementation. Maybe vir-simd needs to consider __cpp_concepts as non-existent with GCC 10.

mattkretz commented 2 weeks ago

'g++-10 (Ubuntu 10.5.0-1ubuntu1~22.04) 10.5.0' passes now on my system. If you can still reproduce any build issues, please reopen.