[Bug c++/91073] [9/10 Regression] if constexpr no longer works directly with Concepts
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Dec 3 14:32:00 GMT 2019
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91073
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed|2019-11-19 00:00:00 |2019-12-3
--- Comment #8 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #6)
> The bug only seems to happen when the concept is variadic.
Or has a default argument, as in the dup I just reported:
template<typename P, typename Arghhh = void>
concept one_or_two = true;
template<typename P>
concept one = one_or_two<P>;
template<typename T>
constexpr void
foo()
{
if (one<T>) // OK
{ }
if (one_or_two<T>) // ERROR
{ }
}
gcc-8-branch accepts this with -fconcepts.
gcc-9-branch rejects it with -fconcepts:
92771.cc: In function 'constexpr void foo()':
92771.cc:14:20: error: expected unqualified-id before ')' token
14 | if (one_or_two<T>) // ERROR
| ^
trunk accepts it with -std=gnu++14 -fconcepts (since r276764) but still rejects
it with -std=gnu++17 -fconcepts or -std=gnu++2a:
92771.cc: In function 'constexpr void foo()':
92771.cc:14:7: error: expected 'auto' or 'decltype(auto)' after 'one_or_two<T>'
14 | if (one_or_two<T>) // ERROR
| ^~~~~~~~~~~~~
92771.cc:14:20: error: expected unqualified-id before ')' token
14 | if (one_or_two<T>) // ERROR
| ^
More information about the Gcc-bugs
mailing list