This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/21426] New: anonymous enums vs. templates
- From: "amu at alum dot mit dot edu" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 6 May 2005 20:11:31 -0000
- Subject: [Bug c++/21426] New: anonymous enums vs. templates
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
If one instance of an overloaded function or operator is generic, I cannot
supply a member of an anonymous enum to that function or operator, even if I
wouldn't be calling the generic instance anyway. As an example of the problem,
attempting to compile the simplified code
class S;
template <typename T> S& operator<< (S&, const T&);
enum { x };
static const int xx = 1 << x;
with G++ 4.0.0 fails with the error
anonenum.cc:5: error: '<anonymous enum>' is/uses anonymous type
anonenum.cc:5: error: trying to instantiate 'template<class T> S&
operator<<(S&, const T&)'
This is a regression over previous versions, which have no problem with such
code. (Neither do other vendors' compilers.)
It is obviously trivial to work around the bug by naming the enum, but I believe
I shouldn't need to.
--
Summary: anonymous enums vs. templates
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: amu at alum dot mit dot edu
CC: gcc-bugs at gcc dot gnu dot org
GCC host triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21426