Commit f4ed7d21 by Nathan Sidwell Committed by Nathan Sidwell

re PR c++/18782 (ICE on invalid pointer-to-member declaration)

cp:
	PR c++/18782
	* decl.c (grokdeclarator): Make sure class in pointer to member is
	not a namespace.
testsuite:
	PR c++/18782
	* g++.dg/parse/ptrmem2.C: New.

From-SVN: r91681
parent bb59c339
2004-12-03 Nathan Sidwell <nathan@codesourcery.com>
PR c++/18782
* decl.c (grokdeclarator): Make sure class in pointer to member is
not a namespace.
2004-12-02 Nathan Sidwell <nathan@codesourcery.com>
PR c++/18318
......
......@@ -7430,8 +7430,19 @@ grokdeclarator (const cp_declarator *declarator,
else if (TREE_CODE (type) == METHOD_TYPE)
type = build_ptrmemfunc_type (build_pointer_type (type));
else if (declarator->kind == cdk_ptrmem)
type = build_ptrmem_type (declarator->u.pointer.class_type,
type);
{
/* We might have parsed a namespace as the class type. */
if (TREE_CODE (declarator->u.pointer.class_type)
== NAMESPACE_DECL)
{
error ("%qD is a namespace",
declarator->u.pointer.class_type);
type = build_pointer_type (type);
}
else
type = build_ptrmem_type (declarator->u.pointer.class_type,
type);
}
else
type = build_pointer_type (type);
......
2004-12-03 Nathan Sidwell <nathan@codesourcery.com>
PR c++/18782
* g++.dg/parse/ptrmem2.C: New.
PR c++/18318
* g++.dg/template/new1.C: New.
......
// { dg-do compile }
// Copyright (C) 2004 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 2 Dec 2004 <nathan@codesourcery.com>
// PR 18782: ICE with ptr-to-member
// Origin: Volker Reichelt <reichelt@gcc.gnu.org>
namespace A {}
int A::* p; // { dg-error "is a namespace" "" }
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