[Bug c++/92214] New: Unhelpful diagnostic for static_assert( some_concept(some_type) )
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Oct 24 17:20:00 GMT 2019
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92214
Bug ID: 92214
Summary: Unhelpful diagnostic for static_assert(
some_concept(some_type) )
Product: gcc
Version: 10.0
Status: UNCONFIRMED
Keywords: diagnostic
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: redi at gcc dot gnu.org
Blocks: 67491
Target Milestone: ---
If you accidentally use parentheses instead of angle brackets you get a
confusing error:
template<typename> concept foo = true;
static_assert( foo(int) );
Compiled with -std=gnu++2a gives:
x.cc:3:16: error: expected 'auto' or 'decltype(auto)' after 'foo'
3 | static_assert( foo(int) );
| ^~~
x.cc:3:23: error: invalid use of 'auto [requires ::foo<<placeholder>, >]'
3 | static_assert( foo(int) );
| ^
x.cc:3:19: error: missing template arguments before '(' token
3 | static_assert( foo(int) );
| ^
x.cc:3:20: error: expected primary-expression before 'int'
3 | static_assert( foo(int) );
| ^~~
I wasn't trying to declare a variable using a placeholder type (which wouldn't
be allowed in a static_assert anyway), I was trying to say foo<int>.
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