c++: Function declared with typedef with eh-specification.
authorJason Merrill <jason@redhat.com>
Mon, 27 Jan 2020 22:55:14 +0000 (17:55 -0500)
committerJason Merrill <jason@redhat.com>
Tue, 28 Jan 2020 14:50:32 +0000 (09:50 -0500)
We just need to handle the exception specification like other properties of
a function typedef.

PR c++/90731
* decl.c (grokdeclarator): Propagate eh spec from typedef.

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/testsuite/g++.dg/cpp1z/noexcept-type22.C [new file with mode: 0644]

index 3d5c9a14492dc36bf0ed92903a1252692885b89f..259b0c717b9f4c8773a973a48706244c744759d9 100644 (file)
@@ -1,3 +1,8 @@
+2020-01-28  Jason Merrill  <jason@redhat.com>
+
+       PR c++/90731
+       * decl.c (grokdeclarator): Propagate eh spec from typedef.
+
 2020-01-28  Martin Liska  <mliska@suse.cz>
 
        PR c++/92440
index e55de5dd53df6f122dbbf9e5fd3a755c0c112631..6ad558eef9e48a58910551cfa88d2ecfd538fc77 100644 (file)
@@ -12848,6 +12848,7 @@ grokdeclarator (const cp_declarator *declarator,
          memfn_quals |= type_memfn_quals (type);
          rqual = type_memfn_rqual (type);
          type_quals = TYPE_UNQUALIFIED;
+         raises = TYPE_RAISES_EXCEPTIONS (type);
        }
     }
 
diff --git a/gcc/testsuite/g++.dg/cpp1z/noexcept-type22.C b/gcc/testsuite/g++.dg/cpp1z/noexcept-type22.C
new file mode 100644 (file)
index 0000000..dd9924f
--- /dev/null
@@ -0,0 +1,6 @@
+// PR c++/90731
+// { dg-do compile { target c++17 } }
+
+typedef void T() noexcept(true);
+T t;
+void t() noexcept(true);