* C++ PATCH for c++/66748 (ICE with abi_tag on enum)
@ 2015-07-03 10:29 Marek Polacek
2015-07-03 14:26 ` Jason Merrill
0 siblings, 1 reply; 2+ messages in thread
From: Marek Polacek @ 2015-07-03 10:29 UTC (permalink / raw)
To: GCC Patches, Jason Merrill
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: C++ PATCH for c++/66748 (ICE with abi_tag on enum)
2015-07-03 10:29 C++ PATCH for c++/66748 (ICE with abi_tag on enum) Marek Polacek
@ 2015-07-03 14:26 ` Jason Merrill
0 siblings, 0 replies; 2+ messages in thread
From: Jason Merrill @ 2015-07-03 14:26 UTC (permalink / raw)
To: Marek Polacek, GCC Patches
OK, thanks.
Jason
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-07-03 14:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-03 10:29 C++ PATCH for c++/66748 (ICE with abi_tag on enum) Marek Polacek
2015-07-03 14:26 ` Jason Merrill
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).