From: Paolo Carlini <paolo.carlini@oracle.com>
To: Marek Polacek <polacek@redhat.com>
Cc: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>,
Jason Merrill <jason@redhat.com>
Subject: Re: [C++ Patch] PR 84636 ("internal compiler error: Segmentation fault (identifier_p()/grokdeclarator())")
Date: Tue, 20 Nov 2018 09:25:00 -0000 [thread overview]
Message-ID: <7fd44f6c-ea51-49a4-8f68-0e18fa2dc215@oracle.com> (raw)
In-Reply-To: <20181119222438.GZ28582@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 776 bytes --]
Hi,
On 19/11/18 23:24, Marek Polacek wrote:
> On Mon, Nov 19, 2018 at 08:03:24PM +0100, Paolo Carlini wrote:
>> @@ -12245,8 +12246,9 @@ grokdeclarator (const cp_declarator *declarator,
>> error ("invalid use of %<::%>");
>> return error_mark_node;
>> }
>> - else if (TREE_CODE (type) == FUNCTION_TYPE
>> - || TREE_CODE (type) == METHOD_TYPE)
>> + else if ((TREE_CODE (type) == FUNCTION_TYPE
>> + || TREE_CODE (type) == METHOD_TYPE)
> I know it's preexisting but we have FUNC_OR_METHOD_TYPE_P for this.
Ah, thanks! I guess I didn't notice that because the macro is defined in
tree.h. I adjusted my first patch and I'll send a separate one for all
the remaining instances (many!) in a separate patch. Thanks again,
Paolo.
////////////////////////
[-- Attachment #2: patch_84636_b --]
[-- Type: text/plain, Size: 1661 bytes --]
Index: cp/decl.c
===================================================================
--- cp/decl.c (revision 266268)
+++ cp/decl.c (working copy)
@@ -12165,7 +12165,8 @@ grokdeclarator (const cp_declarator *declarator,
}
if (ctype && TREE_CODE (type) == FUNCTION_TYPE && staticp < 2
- && !(identifier_p (unqualified_id)
+ && !(unqualified_id
+ && identifier_p (unqualified_id)
&& IDENTIFIER_NEWDEL_OP_P (unqualified_id)))
{
cp_cv_quals real_quals = memfn_quals;
@@ -12245,8 +12246,7 @@ grokdeclarator (const cp_declarator *declarator,
error ("invalid use of %<::%>");
return error_mark_node;
}
- else if (TREE_CODE (type) == FUNCTION_TYPE
- || TREE_CODE (type) == METHOD_TYPE)
+ else if (FUNC_OR_METHOD_TYPE_P (type) && !bitfield)
{
int publicp = 0;
tree function_context;
Index: testsuite/g++.dg/parse/bitfield3.C
===================================================================
--- testsuite/g++.dg/parse/bitfield3.C (revision 266263)
+++ testsuite/g++.dg/parse/bitfield3.C (working copy)
@@ -5,5 +5,5 @@ typedef void (func_type)();
struct A
{
- friend func_type f : 2; /* { dg-error "with non-integral type" } */
+ friend func_type f : 2; /* { dg-error "20:.f. is neither function nor member function" } */
};
Index: testsuite/g++.dg/parse/bitfield6.C
===================================================================
--- testsuite/g++.dg/parse/bitfield6.C (nonexistent)
+++ testsuite/g++.dg/parse/bitfield6.C (working copy)
@@ -0,0 +1,6 @@
+// PR c++/84636
+
+typedef void a();
+struct A {
+a: 1; // { dg-error "bit-field .\\<anonymous\\>. with non-integral type" }
+};
next prev parent reply other threads:[~2018-11-20 9:25 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-19 19:03 Paolo Carlini
2018-11-19 22:26 ` Marek Polacek
2018-11-20 9:25 ` Paolo Carlini [this message]
2018-11-22 0:04 ` Paolo Carlini
2018-12-02 4:26 ` Jason Merrill
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7fd44f6c-ea51-49a4-8f68-0e18fa2dc215@oracle.com \
--to=paolo.carlini@oracle.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jason@redhat.com \
--cc=polacek@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).