[Bug c++/18020] [3.4/4.0 regression] rejects valid definition of enum value in template

bangerth at dealii dot org gcc-bugzilla@gcc.gnu.org
Fri Oct 15 19:17:00 GMT 2004


------- Additional Comments From bangerth at dealii dot org  2004-10-15 19:17 -------
My fault: I missed the last line of the testcase where the instantiation 
is. With this line I can reproduce this bug with both stock 3.4.2 as well 
as with the present top-of-branch 3.4 compiler. 
 
The bug doesn't happen with gcc 3.3, which makes this a regression. Here's 
the testcase in slightly modified version: 
------------------ 
template <typename> struct bar { 
    enum { 
          e1 = 1, 
          e2 = ~e1 
    }; 
}; 
template struct bar<int>; 
-------------------- 
 
g/x> /home/bangerth/bin/gcc-4*/bin/c++ -c x.cc 
x.cc: In instantiation of `bar<int>': 
x.cc:7:   instantiated from here 
x.cc:2: error: enumerator value for 'e2' not integer constant 
 
The problem doesn't happen when the class isn't a template. 
W. 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
           Keywords|                            |rejects-valid
      Known to fail|                            |3.4.2 3.4.3 4.0.0
      Known to work|                            |3.3.4
         Resolution|WORKSFORME                  |
            Summary|issue with enum in a        |[3.4/4.0 regression] rejects
                   |template                    |valid definition of enum
                   |                            |value in template
   Target Milestone|---                         |3.4.3


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



More information about the Gcc-bugs mailing list