]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
PR c++/80244 - ICE with attribute in template alias.
authorMarek Polacek <polacek@redhat.com>
Sat, 24 Jun 2017 10:53:48 +0000 (10:53 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Sat, 24 Jun 2017 10:53:48 +0000 (10:53 +0000)
* tree.c (strip_typedefs): Handle UNDERLYING_TYPE.

* g++.dg/cpp0x/alias-decl-59.C: New test.

From-SVN: r249622

gcc/cp/ChangeLog
gcc/cp/tree.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/alias-decl-59.C [new file with mode: 0644]

index 57db5ca858f91123b9ee4346cfe05624a6f18509..17085d81ce18d930b8f093af1fd40458f62bc451 100644 (file)
@@ -8,6 +8,11 @@
        * parser.c (cp_parser_std_attribute_list): Return error_mark if
        make_pack_expansion returns an error.
 
+       2017-04-18  Marek Polacek  <polacek@redhat.com>
+
+       PR c++/80244 - ICE with attribute in template alias.
+       * tree.c (strip_typedefs): Handle UNDERLYING_TYPE.
+
 2017-06-22  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
index fe04f2b71251b3901d4be9e442a99f6b860333f0..c1e6dbb805ddd545d0bbcf668f9257a68491f5f8 100644 (file)
@@ -1457,6 +1457,10 @@ strip_typedefs (tree t, bool *remove_attributes)
                   DECLTYPE_TYPE_ID_EXPR_OR_MEMBER_ACCESS_P (t),
                   tf_none));
       break;
+    case UNDERLYING_TYPE:
+      type = strip_typedefs (UNDERLYING_TYPE_TYPE (t), remove_attributes);
+      result = finish_underlying_type (type);
+      break;
     default:
       break;
     }
index 337620c1ef094e9354ea83fbc88ef4e5491d9a7c..bbb56ad894b8de4e6f2f3f74caa90a6c1696ffaf 100644 (file)
@@ -6,6 +6,9 @@
        PR c++/80241 - ICE with alignas pack expansion.
        * g++.dg/cpp0x/alignas11.C: New test.
 
+       PR c++/80244 - ICE with attribute in template alias.
+       * g++.dg/cpp0x/alias-decl-59.C: New test.
+
 2017-06-23  Thomas Preud'homme  <thomas.preudhomme@arm.com>
 
        Backport from mainline
diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-59.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-59.C
new file mode 100644 (file)
index 0000000..1f5e94f
--- /dev/null
@@ -0,0 +1,11 @@
+// PR c++/80244
+// { dg-do compile { target c++11 } }
+
+template<typename>
+struct A {};
+
+template<typename T>
+using B = A<__underlying_type(T) [[gnu::aligned(4)]]>; // { dg-warning "ignoring attributes on template argument" }
+
+template<typename T>
+using B = A<__underlying_type(T) [[gnu::packed]]>; // { dg-warning "ignoring attributes on template argument" }