* cp-tree.h (CLASSTYPE_PRIMARY_TEMPLATE): New macro.
* parser.c (cp_parser_diagnose_invalid_type_name): Use it.
* pt.c (instantiate_class_template): Don't try to instantiate
dependent types.
(resolve_typename_type): Use CLASSTYPE_PRIMARY_TEMPLATE.
PR c++/5333
* g++.dg/parse/fused-params1.C: Adjust error messages.
* g++.dg/template/nested3.C: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@63354
138bc75d-0d04-0410-961f-
82ee72b054a4
+2003-02-23 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/5333
+ * cp-tree.h (CLASSTYPE_PRIMARY_TEMPLATE): New macro.
+ * parser.c (cp_parser_diagnose_invalid_type_name): Use it.
+ * pt.c (instantiate_class_template): Don't try to instantiate
+ dependent types.
+ (resolve_typename_type): Use CLASSTYPE_PRIMARY_TEMPLATE.
+
2003-02-21 Mark Mitchell <mark@codesourcery.com>
PR c++/9749
#define ENUM_TI_ARGS(NODE) \
TI_ARGS (ENUM_TEMPLATE_INFO (NODE))
+/* For a template instantiation TYPE, returns the TYPE corresponding
+ to the primary template. */
+#define CLASSTYPE_PRIMARY_TEMPLATE_TYPE(TYPE) \
+ TREE_TYPE (DECL_TEMPLATE_RESULT (DECL_PRIMARY_TEMPLATE \
+ (CLASSTYPE_TI_TEMPLATE ((TYPE)))))
+
/* Like DECL_TI_TEMPLATE, but for an ENUMERAL_, RECORD_, or UNION_TYPE. */
#define TYPE_TI_TEMPLATE(NODE) \
(TI_TEMPLATE (TYPE_TEMPLATE_INFO (NODE)))
template (which will have an empty TYPE_FIELDs),
to the main version. */
if (CLASSTYPE_USE_TEMPLATE (base_type))
- base_type = (TREE_TYPE
- (DECL_TEMPLATE_RESULT
- (DECL_PRIMARY_TEMPLATE
- (CLASSTYPE_TI_TEMPLATE (base_type)))));
+ base_type = CLASSTYPE_PRIMARY_TEMPLATE_TYPE (base_type);
for (field = TYPE_FIELDS (base_type);
field;
field = TREE_CHAIN (field))
/* Parse a new-expression.
+ new-expression:
:: [opt] new new-placement [opt] new-type-id new-initializer [opt]
:: [opt] new new-placement [opt] ( type-id ) new-initializer [opt]
if (type == error_mark_node)
return error_mark_node;
- if (TYPE_BEING_DEFINED (type) || COMPLETE_TYPE_P (type))
+ if (TYPE_BEING_DEFINED (type)
+ || COMPLETE_TYPE_P (type)
+ || dependent_type_p (type))
return type;
/* Figure out which template is being instantiated. */
to look inside it. */
if (only_current_p && !currently_open_class (scope))
return error_mark_node;
+ /* If SCOPE is a partial instantiation, it will not have a valid
+ TYPE_FIELDS list, so use the original template. */
+ if (CLASSTYPE_USE_TEMPLATE (scope))
+ scope = CLASSTYPE_PRIMARY_TEMPLATE_TYPE (scope);
/* Enter the SCOPE so that name lookup will be resolved as if we
were in the class definition. In particular, SCOPE will no
longer be considered a dependent type. */
+2003-02-23 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/5333
+ * g++.dg/parse/fused-params1.C: Adjust error messages.
+ * g++.dg/template/nested3.C: New test.
+
2003-02-24 Alan Modra <amodra@bigpond.net.au>
* g++.dg/abi/param1.C: New test.
// { dg-do compile }
template <int N,typename T> struct A
-{
+{ // { dg-error "" }
typedef T X;
- template <int M> void foo (const A<M,X>&); // { dg-error "candidate" }
+ template <int M> void foo (const A<M,X>&);
};
template <int N,int M,typename T>
--- /dev/null
+template <class T1, class T2>
+class A {
+ template <class S>
+ class SubA {
+ int _k;
+ };
+ T1 _t1;
+ T2 _t2;
+};
+
+template <class U>
+class B {
+ class SubB1 {
+ B _i;
+ };
+
+ class SubB2 {
+ int _j;
+ };
+ A<U,SubB1>::SubA<SubB2> _a; // { dg-error "" }
+};
+
+
+int main() {
+ B<char> objB;
+
+ return 0;
+}