public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/21426] New: anonymous enums vs. templates
@ 2005-05-06 20:11 amu at alum dot mit dot edu
  2005-05-06 20:16 ` [Bug c++/21426] " pinskia at gcc dot gnu dot org
  0 siblings, 1 reply; 2+ messages in thread
From: amu at alum dot mit dot edu @ 2005-05-06 20:11 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug c++/21426] anonymous enums vs. templates
  2005-05-06 20:11 [Bug c++/21426] New: anonymous enums vs. templates amu at alum dot mit dot edu
@ 2005-05-06 20:16 ` pinskia at gcc dot gnu dot org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-05-06 20:16 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-05-06 20:16 -------
The code is invalid, see PR 19404 and PR 20589

*** This bug has been marked as a duplicate of 19404 ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21426


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-05-06 20:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-05-06 20:11 [Bug c++/21426] New: anonymous enums vs. templates amu at alum dot mit dot edu
2005-05-06 20:16 ` [Bug c++/21426] " pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).