[Bug c++/20333] [3.4/4.0/4.1 Regression] ICE on invalid code, typename outside of a template

pinskia at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Sat Mar 5 19:40:00 GMT 2005

------- Additional Comments From pinskia at gcc dot gnu dot org  2005-03-05 19:40 -------
I take that back, this is invalid code still, the typename keyword is not valid outside of a template.
Reduced testcase:
template<class> struct f {};
f<int> f2[2] = {typename f<int>()};

This is a regression from 3.3.3.  We should be able to recover much better in 3.4.0 than we did in 3.3.3 
but we don't.  In fact I would have assumed that we would get a better error message before ICEing.  
Even though in the full testcase we don't get an error, we do in the reduced testcase though:
t.cc:3: error: expected nested-name-specifier

           What    |Removed                     |Added
                 CC|                            |pinskia at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |error-recovery, ice-on-
                   |                            |invalid-code
      Known to fail|                            |3.4.0 4.1.0
      Known to work|                            |3.3.3
   Last reconfirmed|0000-00-00 00:00:00         |2005-03-05 19:40:09
               date|                            |
            Summary|ICE                         |[3.4/4.0/4.1 Regression] ICE
                   |                            |on invalid code, typename
                   |                            |outside of a template
   Target Milestone|---                         |3.4.4


More information about the Gcc-bugs mailing list