]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
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:53:16 +0000 (09:53 -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 9b1e506c8ccc55980d2f7c81d9f0eb98e10cbfd0..43fcf822df9cdf16fd8588cacc2c8bb33aff0895 100644 (file)
@@ -1,5 +1,8 @@
 2020-01-28  Jason Merrill  <jason@redhat.com>
 
+       PR c++/90731
+       * decl.c (grokdeclarator): Propagate eh spec from typedef.
+
        PR c++/90966
        * pt.c (tsubst_copy) [STRING_CST]: Don't use fold_convert.
 
index f3f20b55c8b5fb1bbc05cc3117b269384637f3a3..b106d8f44adf0c0b7e3dbc61accf6b1ddab03b09 100644 (file)
@@ -12181,6 +12181,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);