This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

ICE on invalid c++


template <class T> class C {
    typedef T* int;
};

ICEs due to the fact the DECL_NAME is 0. With the below patch, we now get:

t1.cc:2: error: expected unqualified-id before 'int'
t1.cc:2: error: expected ';' before 'int'

and no ICE. Now, the only question is, do we want to put the check here, or, should we catch this sooner?

This is a regression from 3.3.

Ok?


Radar 4333995


2005-12-23 Mike Stump <mrs@apple.com>

* pt.c (build_template_decl): Avoid ICE on decls with no names.

Doing diffs in .:
--- ./cp/pt.c.~1~ 2005-12-16 11:35:02.000000000 -0800
+++ ./cp/pt.c 2005-12-23 10:29:08.000000000 -0800
@@ -2506,7 +2506,8 @@ build_template_decl (tree decl, tree par
DECL_DESTRUCTOR_P (tmpl) = DECL_DESTRUCTOR_P (decl);
DECL_NONCONVERTING_P (tmpl) = DECL_NONCONVERTING_P (decl);
DECL_ASSIGNMENT_OPERATOR_P (tmpl) = DECL_ASSIGNMENT_OPERATOR_P (decl);
- if (DECL_OVERLOADED_OPERATOR_P (decl))
+ if (DECL_NAME (decl)
+ && DECL_OVERLOADED_OPERATOR_P (decl))
SET_OVERLOADED_OPERATOR_CODE (tmpl,
DECL_OVERLOADED_OPERATOR_P (decl));
}
--------------



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]