re PR c++/33969 (ICE with const and function pointer)

PR c++/33969
	* decl.c (grokdeclarator): Don't call build_memfn_type if type
	is neither FUNCTION_TYPE nor METHOD_TYPE.

	* g++.dg/other/ptrmem9.C: New test.

From-SVN: r129895
This commit is contained in:
Jakub Jelinek 2007-11-05 09:10:09 +01:00 committed by Jakub Jelinek
parent 9656bc0fdc
commit 1b021ff438
4 changed files with 18 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2007-11-05 Jakub Jelinek <jakub@redhat.com>
PR c++/33969
* decl.c (grokdeclarator): Don't call build_memfn_type if type
is neither FUNCTION_TYPE nor METHOD_TYPE.
2007-11-02 Jakub Jelinek <jakub@redhat.com>
PR c++/33516

View File

@ -8153,7 +8153,8 @@ grokdeclarator (const cp_declarator *declarator,
type_quals = TYPE_UNQUALIFIED;
if (declarator->kind == cdk_ptrmem
&& (TREE_CODE (type) == FUNCTION_TYPE || memfn_quals))
&& (TREE_CODE (type) == FUNCTION_TYPE
|| (memfn_quals && TREE_CODE (type) == METHOD_TYPE)))
{
memfn_quals |= cp_type_quals (type);
type = build_memfn_type (type,

View File

@ -1,3 +1,8 @@
2007-11-05 Jakub Jelinek <jakub@redhat.com>
PR c++/33969
* g++.dg/other/ptrmem9.C: New test.
2007-11-04 Andrew Pinski <pinskia@gmail.com>
PR middle-end/32931

View File

@ -0,0 +1,5 @@
// PR c++/33969
// { dg-do compile }
struct A;
void (*A::* fp)() const; // { dg-error "invalid in variable declaration" }