https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118791

--- Comment #3 from sandra at gcc dot gnu.org ---
Curiously, on the OG14 development branch the rvalue calls work but the lvalue
ones are broken instead:

$ install/bin/x86_64-none-linux-gnu-g++ -fopenmp -S quux.C 
quux.C: In instantiation of 'void lvalue_int_variant(T&&) [with T = int&&]':
quux.C:21:30:   required by substitution of 'template<class T> void
lvalue_int(T&&) [with T = int&]'
   21 | #pragma omp declare variant (lvalue_int_variant) match
(implementation={vendor("gnu")})
      |                              ^~~~~~~~~~~~~~~~~~
quux.C:76:19:   required from here
   76 |   lvalue_int<int&>(lvalue);
      |   ~~~~~~~~~~~~~~~~^~~~~~~~
quux.C:16:35: error: static assertion failed
   16 |   static_assert(is_same<T, int&>::value);
      |                                   ^~~~~
quux.C:16:35: note: 'is_same<int&&, int&>::value' evaluates to false
quux.C: In instantiation of 'void lvalue_const_int_variant(T&&) [with T = const
int&&]':
quux.C:36:30:   required by substitution of 'template<class T> void
lvalue_const_int(T&&) [with T = const int&]'
   36 | #pragma omp declare variant (lvalue_const_int_variant) match
(implementation={vendor("gnu")})
      |                              ^~~~~~~~~~~~~~~~~~~~~~~~
quux.C:77:31:   required from here
   77 |   lvalue_const_int<int const&>(static_cast<int const&>(lvalue));
      |   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
quux.C:31:41: error: static assertion failed
   31 |   static_assert(is_same<T, int const&>::value);
      |                                         ^~~~~
quux.C:31:41: note: 'is_same<const int&&, const int&>::value' evaluates to
false

So this might actually be a regression in GCC 15 -- perhaps the fix for the
lvalue case ended up breaking the rvalue case instead.  Probably should
double-check against the GCC 15 branch point to ensure the different behavior
is not specific to the OG15 branch, then git bisect.

Reply via email to