diff options
author | Mark Mitchell <mark@codesourcery.com> | 1999-04-22 16:26:44 +0000 |
---|---|---|
committer | Mark Mitchell <mmitchel@gcc.gnu.org> | 1999-04-22 16:26:44 +0000 |
commit | ad810b22b8476715dbd544924f92fb9ee2f60d52 (patch) | |
tree | 48ab8a45a24c47274b09a6a46545e9df50533a1b | |
parent | c9eb638ec76e41c7624b2fafe2797e47b76ca43b (diff) | |
download | gcc-ad810b22b8476715dbd544924f92fb9ee2f60d52.zip gcc-ad810b22b8476715dbd544924f92fb9ee2f60d52.tar.gz gcc-ad810b22b8476715dbd544924f92fb9ee2f60d52.tar.bz2 |
* decl.c (make_typename_type): Tighten error-checking.
From-SVN: r26586
-rw-r--r-- | gcc/cp/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/cp/decl.c | 13 | ||||
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.pt/crash38.C | 16 |
3 files changed, 27 insertions, 6 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 4740af5..fc813fe 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,7 @@ +1999-04-22 Mark Mitchell <mark@codesourcery.com> + + * decl.c (make_typename_type): Tighten error-checking. + 1999-04-20 Mark Mitchell <mark@codesourcery.com> * cp-tree.h (build_binary_op): Remove unneeded parameter. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 331d627..917535a 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -5385,19 +5385,20 @@ make_typename_type (context, name) { if (TREE_CODE (fullname) == TEMPLATE_ID_EXPR) { + tree tmpl = NULL_TREE; if (IS_AGGR_TYPE (context)) - t = lookup_field (context, name, 0, 0); - else + tmpl = lookup_field (context, name, 0, 0); + if (!tmpl || !DECL_CLASS_TEMPLATE_P (tmpl)) { cp_error ("no class template named `%#T' in `%#T'", name, context); return error_mark_node; } - if (t && DECL_CLASS_TEMPLATE_P (t)) - return lookup_template_class (t, TREE_OPERAND (fullname, 1), - NULL_TREE, context, - /*entering_scope=*/0); + return lookup_template_class (tmpl, + TREE_OPERAND (fullname, 1), + NULL_TREE, context, + /*entering_scope=*/0); } else { diff --git a/gcc/testsuite/g++.old-deja/g++.pt/crash38.C b/gcc/testsuite/g++.old-deja/g++.pt/crash38.C new file mode 100644 index 0000000..4927064 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/crash38.C @@ -0,0 +1,16 @@ +// Build don't link: +// Origin: Mark Mitchell <mark@codesourcery.com> + +template <class T> +struct S { + typedef typename T::Y<T>::Z X; // ERROR - No Y in A + X x; // ERROR - No Y in A +}; + +struct A { + struct Y { + typedef A Z; + }; +}; + +template struct S<A>; |