[Bug c++/21426] New: anonymous enums vs. templates
amu at alum dot mit dot edu
gcc-bugzilla@gcc.gnu.org
Fri May 6 20:11:00 GMT 2005
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
More information about the Gcc-bugs
mailing list