Commit 7fcefa55 by Paolo Carlini Committed by Paolo Carlini

re PR c++/50864 (ICE with decltype and "declval" from another namespace)

/cp
2011-11-08  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/50864
	* parser.c (cp_parser_postfix_dot_deref_expression): Reject invalid
	uses of '->' and '.' as postfix-expression in namespace scope.

/testsuite
2011-11-08  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/50864
	* g++.dg/parse/template26.C: New.
	* g++.dg/template/crash45.C: Adjust dg-error string.

From-SVN: r181151
parent 29525822
2011-11-08 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/50864
* parser.c (cp_parser_postfix_dot_deref_expression): Reject invalid
uses of '->' and '.' as postfix-expression in namespace scope.
2011-11-07 Jason Merrill <jason@redhat.com>
PR c++/50848
......
......@@ -5969,6 +5969,13 @@ cp_parser_postfix_dot_deref_expression (cp_parser *parser,
{
if (name != error_mark_node && !BASELINK_P (name) && parser->scope)
{
if (TREE_CODE (parser->scope) == NAMESPACE_DECL)
{
error_at (token->location, "%<%D::%D%> is not a class member",
parser->scope, name);
postfix_expression = error_mark_node;
}
else
name = build_qualified_name (/*type=*/NULL_TREE,
parser->scope,
name,
......
2011-11-08 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/50864
* g++.dg/parse/template26.C: New.
* g++.dg/template/crash45.C: Adjust dg-error string.
2011-11-07 Jason Merrill <jason@redhat.com>
PR c++/50848
......
// PR c++/50864
namespace impl
{
template <class T> T create();
}
template <class T, class U, __SIZE_TYPE__
= sizeof(impl::create<T>()->*impl::create<U>())>
struct foo1;
template <class T, class U, __SIZE_TYPE__
= sizeof(impl::create<T>()->impl::create<U>())> // { dg-error "not a class member" }
struct foo2;
template <class T, class U, __SIZE_TYPE__
= sizeof(impl::create<T>().impl::create<U>())> // { dg-error "not a class member" }
struct foo3;
......@@ -9,5 +9,5 @@ namespace N
void bar(A *p)
{
p->N::foo<0>; // { dg-error "not a member" }
p->N::foo<0>; // { dg-error "not a class member" }
}
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