[Bug c++/92771] New: [9/10 Regression] Concept won't use default template argument
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Dec 3 13:55:00 GMT 2019
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92771
Bug ID: 92771
Summary: [9/10 Regression] Concept won't use default template
argument
Product: gcc
Version: 9.2.1
Status: UNCONFIRMED
Keywords: rejects-valid
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: redi at gcc dot gnu.org
CC: paolo at gcc dot gnu.org
Blocks: 67491
Target Milestone: ---
template<typename P, typename Q, typename Arghhh = void>
concept three = sizeof(P) == sizeof(Q);
#ifdef WORKAROUND
template<typename P, typename Q>
concept two = three<P, Q>;
#define three two
#endif
template<typename T, typename U>
constexpr auto
foo(const T& t, const U& u)
{
if constexpr (three<T, U>)
return &t == &u;
return false;
}
int main()
{
return foo(1, 2);
}
Using -std=gnu++2a this fails to compile:
c3.cc: In function 'constexpr auto foo(const T&, const U&)':
c3.cc:14:17: error: expected 'auto' or 'decltype(auto)' after 'three<T, U>'
14 | if constexpr (three<T, U>)
| ^~~~~~~~~~~
c3.cc:14:28: error: expected unqualified-id before ')' token
14 | if constexpr (three<T, U>)
| ^
Defining WORKAROUND to add the indirection through 'two' fixes it.
This was accepted prior to r260482 (which was fixing PR c++/84588).
Referenced Bugs:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67491
[Bug 67491] [meta-bug] concepts issues
More information about the Gcc-bugs
mailing list