[Bug c++/96830] GCC does not complain template-head containing requires clause
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Aug 28 11:26:35 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96830
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
G++ still accepts this version, though EDG and Clang reject it:
template<typename T> concept C = requires { typename T::value_type; };
template<C Container>
class Foo {
public:
void func();
};
template<typename Container>
void Foo<Container>::func()
{}
$ edg --c++20 -c 96830.C
"96830.C", line 10: error: template argument list must match the parameter list
void Foo<Container>::func()
^
1 error detected in the compilation of "96830.C".
$ clang++ -std=c++2a -c 96830.C
96830.C:9:10: error: type constraint differs in template redeclaration
template<typename Container>
^
96830.C:3:10: note: previous template declaration is here
template<C Container>
^
1 error generated.
More information about the Gcc-bugs
mailing list