PR c++/80244 - ICE with attribute in template alias.
authorMarek Polacek <polacek@redhat.com>
Tue, 18 Apr 2017 09:34:10 +0000 (09:34 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Tue, 18 Apr 2017 09:34:10 +0000 (09:34 +0000)
* tree.c (strip_typedefs): Handle UNDERLYING_TYPE.

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

From-SVN: r246962

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 3d36c6bd6907cf841e805d76a9b3da75dc222f67..3f87d715dd27c6ae2c2dc089b9f49588277f56c2 100644 (file)
@@ -1,3 +1,8 @@
+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-04-17  Bernd Edlinger  <bernd.edlinger@hotmail.de>
 
        PR c++/80287
index a1455c2b4b44d8706d6a70d6de4b9b6080a5883c..f1b0a57e15898f2207d4c7ac3207dd1c2860e7ab 100644 (file)
@@ -1551,6 +1551,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 6f9932a3b51905e8d992d95a6cc5319aa9db57d4..ca0717ec69429f5dd968192ef07c3afb5f09615f 100644 (file)
@@ -1,3 +1,8 @@
+2017-04-18  Marek Polacek  <polacek@redhat.com>
+
+       PR c++/80244 - ICE with attribute in template alias.
+       * g++.dg/cpp0x/alias-decl-59.C: New test.
+
 2017-04-17  Bernd Edlinger  <bernd.edlinger@hotmail.de>
 
        PR c++/80287
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" }