[Bug c++/71825] incorrectly rejects valid C++ code with a template class inside a namespace
pinskia at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Dec 9 01:04:47 GMT 2021
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71825
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords|rejects-valid |accepts-invalid, diagnostic
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
ICC rejects this with:
<source>(7): error: class template and template parameter may not have the same
name
template < class A > struct N::A
^
When struct A is not in a namespace GCC, clang and MSVC all reject it with a
similar message. I suspect ICC gets this right really. That is it should be
rejected due to the name being the same.
In fact if we did:
namespace N
{
template < class A > struct A
{
};
}
GCC, clang and MSVC reject it too.
More information about the Gcc-bugs
mailing list