re PR c++/66748 (Crash with abi_tag attribute)
authorMarek Polacek <polacek@redhat.com>
Wed, 8 Jul 2015 10:36:26 +0000 (10:36 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Wed, 8 Jul 2015 10:36:26 +0000 (10:36 +0000)
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.

From-SVN: r225541

gcc/cp/ChangeLog
gcc/cp/tree.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/abi/abi-tag15.C [new file with mode: 0644]

index c345f83d9e6e2e8b5478bd4d389ccba68c185914..e469156c8ff645db0661084d6a6921d3c3511c6b 100644 (file)
@@ -1,3 +1,9 @@
+2015-07-08  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.
+
 2015-07-07  Andrew MacLeod  <amacleod@redhat.com>
 
        * call.c: Adjust includes.
index 4fcdb6c52a68814fa11a6e37d59887dc69a10a5d..149c37da908c724fdec94525e55f450bea32c9a8 100644 (file)
@@ -3653,13 +3653,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);
index f02d3e5f167d9d97edef08c4b59e5cd7f03bb4e1..7370e8fe3dbf3a4fc1d455c7d74a6f3e2f9bc0d4 100644 (file)
@@ -1,3 +1,8 @@
+2015-07-08  Marek Polacek  <polacek@redhat.com>
+
+       PR c++/66748
+       * g++.dg/abi/abi-tag15.C: New test.
+
 2015-07-08  Andrew Bennett  <andrew.bennett@imgtec.com>
 
        * gcc.target/mips/branch-2.c: Change NOMIPS16 to NOCOMPRESSION.
diff --git a/gcc/testsuite/g++.dg/abi/abi-tag15.C b/gcc/testsuite/g++.dg/abi/abi-tag15.C
new file mode 100644 (file)
index 0000000..bfda3a2
--- /dev/null
@@ -0,0 +1,3 @@
+// PR c++/66748
+
+enum __attribute__((abi_tag("foo"))) E {}; // { dg-error "redeclaration of" }