Commit a2712544 by Andrew Pinski Committed by Andrew Pinski

re PR c++/29388 (ICE with invalid nested name specifier)


2009-01-15  Andrew Pinski  <andrew_pinski@playstation.sony.com>

        PR C++/29388
        * decl.c (grokdeclarator): Check for a non namespace/class context.


2009-01-15  Andrew Pinski  <andrew_pinski@playstation.sony.com>

        PR C++/29388
        * g++.dg/template/error37.C: New testcase.

From-SVN: r143411
parent 574af2d6
2009-01-15 Andrew Pinski <andrew_pinski@playstation.sony.com>
PR C++/29388
* decl.c (grokdeclarator): Check for a non namespace/class context.
2009-01-15 Jason Merrill <jason@redhat.com>
PR c++/36334
......
......@@ -9285,6 +9285,13 @@ grokdeclarator (const cp_declarator *declarator,
"declared out of global scope", name);
}
if (ctype != NULL_TREE
&& TREE_CODE (ctype) != NAMESPACE_DECL && !MAYBE_CLASS_TYPE_P (ctype))
{
error ("%q#T is not a class or a namespace", ctype);
ctype = NULL_TREE;
}
if (ctype == NULL_TREE)
{
if (virtualp)
......
2009-01-15 Andrew Pinski <andrew_pinski@playstation.sony.com>
PR C++/29388
* g++.dg/template/error37.C: New testcase.
2009-01-15 Jason Merrill <jason@redhat.com>
PR c++/36334
......
// { dg-do compile }
// PR C++/29388
// We used to ICE in is_ancestor because we would use int as the context of foo
// but that is invalid.
template<int> struct A
{
typedef int T;
void foo();
};
template<int N> void A<N>::T::foo() {} // { dg-error "" }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment