From: Marek Polacek <polacek@redhat.com>
To: GCC Patches <gcc-patches@gcc.gnu.org>, Jason Merrill <jason@redhat.com>
Subject: C++ PATCH for c++/66748 (ICE with abi_tag on enum)
Date: Fri, 03 Jul 2015 10:29:00 -0000 [thread overview]
Message-ID: <20150703102940.GC10139@redhat.com> (raw)
The following testcase was breaking because we we're trying to
access TYPE_LANG_SPECIFIC via CLASSTYPE_TEMPLATE_* macros without
first checking that we indeed have a CLASS_TYPE.
Bootstrapped/regtested on x86_64-linux, ok for trunk/5/4.9?
2015-07-03 Marek Polacek <polacek@redhat.com>
PR c++/66748
* tree.c (handle_abi_tag_attribute): Check for CLASS_TYPE_P before
accessing TYPE_LANG_SPECIFIC node.
* g++.dg/abi/abi-tag15.C: New test.
diff --git gcc/cp/tree.c gcc/cp/tree.c
index 0d1112c..22d5b3a 100644
--- gcc/cp/tree.c
+++ gcc/cp/tree.c
@@ -3654,13 +3654,15 @@ handle_abi_tag_attribute (tree* node, tree name, tree args,
name, *node);
goto fail;
}
- else if (CLASSTYPE_TEMPLATE_INSTANTIATION (*node))
+ else if (CLASS_TYPE_P (*node)
+ && CLASSTYPE_TEMPLATE_INSTANTIATION (*node))
{
warning (OPT_Wattributes, "ignoring %qE attribute applied to "
"template instantiation %qT", name, *node);
goto fail;
}
- else if (CLASSTYPE_TEMPLATE_SPECIALIZATION (*node))
+ else if (CLASS_TYPE_P (*node)
+ && CLASSTYPE_TEMPLATE_SPECIALIZATION (*node))
{
warning (OPT_Wattributes, "ignoring %qE attribute applied to "
"template specialization %qT", name, *node);
diff --git gcc/testsuite/g++.dg/abi/abi-tag15.C gcc/testsuite/g++.dg/abi/abi-tag15.C
index e69de29..bfda3a2 100644
--- gcc/testsuite/g++.dg/abi/abi-tag15.C
+++ gcc/testsuite/g++.dg/abi/abi-tag15.C
@@ -0,0 +1,3 @@
+// PR c++/66748
+
+enum __attribute__((abi_tag("foo"))) E {}; // { dg-error "redeclaration of" }
Marek
next reply other threads:[~2015-07-03 10:29 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-03 10:29 Marek Polacek [this message]
2015-07-03 14: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=20150703102940.GC10139@redhat.com \
--to=polacek@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jason@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).