Commit 2ee366b5 by Gabriel Dos Reis Committed by Gabriel Dos Reis

PRs C++/6803, C++/7721 and C++/7803

        PRs C++/6803, C++/7721 and C++/7803
        * decl.c (grokdeclarator): Gracefully handle template-name as
        decl-specifier.

From-SVN: r58058
parent 01c3fb15
2002-10-11 Gabriel Dos Reis <gdr@integrable-solutions.net>
PRs C++/6803, C++/7721 and C++/7803
* decl.c (grokdeclarator): Gracefully handle template-name as
decl-specifier.
2002-10-11 Jason Molenda <jmolenda@apple.com> 2002-10-11 Jason Molenda <jmolenda@apple.com>
* init.c (build_field_list): Provide uses_unions_p with a default * init.c (build_field_list): Provide uses_unions_p with a default
......
...@@ -10249,6 +10249,15 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist) ...@@ -10249,6 +10249,15 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
case BASELINK: case BASELINK:
next = &BASELINK_FUNCTIONS (decl); next = &BASELINK_FUNCTIONS (decl);
break; break;
case TEMPLATE_DECL:
/* Sometimes, we see a template-name used as part of a
decl-specifier like in
std::allocator alloc;
Handle that gracefully. */
error ("invalid use of template-name '%E' in a declarator", decl);
return error_mark_node;
break;
default: default:
my_friendly_assert (0, 20020917); my_friendly_assert (0, 20020917);
......
// Contributed by Gabriel Dos Reis <gdr@integrable-solutions.net>
// Origin: PRs 7721 and 7803
// { dg-do compile }
namespace N
{
template<typename>
struct X { };
}
N::X X; // { dg-error "" "" }
int main()
{
return sizeof(X); // { 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