[Bug c++/108282] New: Disabled template method using requires-clause still viable through requires-expression
turningtides at outlook dot de
gcc-bugzilla@gcc.gnu.org
Wed Jan 4 02:50:04 GMT 2023
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108282
Bug ID: 108282
Summary: Disabled template method using requires-clause still
viable through requires-expression
Product: gcc
Version: 12.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: turningtides at outlook dot de
Target Milestone: ---
Created attachment 54185
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54185&action=edit
source code for gcc 12.2
$ gcc bug.cpp -std=c++20
Log:
bug.cpp: In function ‘int main()’:
bug.cpp:13:33: error: static assertion failed
13 | static_assert( TEST <B <C>> == false );
| ~~~~~~~~~~~~~^~~~~~~~
bug.cpp:13:33: note: the comparison reduces to ‘(1 == 0)’
bug.cpp:15:14: error: no matching function for call to ‘B<C>::TT()’
15 | B <C>::TT(); // fails to compile!
| ~~~~~~~~~^~
bug.cpp:7:24: note: candidate: ‘static void B<AT>::TT() requires TEST<AT>
[with AT = C]’
7 | static inline void TT() noexcept requires ( TEST <AT> );
| ^~
bug.cpp:7:24: note: constraints not satisfied
bug.cpp: In instantiation of ‘static void B<AT>::TT() requires TEST<AT> [with
AT = C]’:
bug.cpp:15:14: required from here
bug.cpp:2:9: required for the satisfaction of ‘TEST<AT>’ [with AT = C]
bug.cpp:2:16: in requirements [with T = C]
bug.cpp:2:30: note: the required expression ‘T::TT’ is invalid
2 | concept TEST = requires { T::TT; };
| ^~
cc1plus: note: set ‘-fconcepts-diagnostics-depth=’ to at least 2 for more
detail
More information about the Gcc-bugs
mailing list