comparison gcc/testsuite/g++.dg/ext/attr-nothrow-3.C @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents
children
comparison
equal deleted inserted replaced
111:04ced10e8804 131:84e7813d76e9
1 /* PR c++/84294 - attributes on a function template redeclaration silently
2 discarded
3 { dg-do compile }
4 { dg-options "-O -fdump-tree-eh -fdump-tree-optimized" } */
5
6 typedef void Func ();
7
8 template <Func>
9 void fail_func () throw ();
10
11 template <Func test>
12 void test_func () throw ()
13 {
14 try
15 {
16 test ();
17 }
18 catch (...)
19 {
20 // Should be eliminated.
21 fail_func<test> ();
22 }
23 }
24
25 void __attribute__ ((nothrow)) func_nothrow_none ();
26 void func_nothrow_none ();
27
28 template void test_func<func_nothrow_none>();
29
30
31 void func_none_nothrow ();
32 void __attribute__ ((nothrow)) func_none_nothrow ();
33
34 template void test_func<func_none_nothrow>();
35
36
37 template <class>
38 void __attribute__ ((nothrow)) templ_nothrow_none ();
39
40 template <class>
41 void templa_nothrow_none ();
42
43 template void test_func<templ_nothrow_none<int> >();
44
45
46 template <class>
47 void templ_none_nothrow ();
48
49 template <class>
50 void __attribute__ ((nothrow)) templ_none_nothrow ();
51
52 template void test_func<templ_none_nothrow<int> >();
53
54
55 // Verify that no exception handling code was emitted.
56 // { dg-final { scan-tree-dump-not "eh_dispatch" "eh" } }
57 // { dg-final { scan-tree-dump-not "resx" "eh" } }
58
59 // Verify that calls to fail_func() specializations have been eliminated.
60 // { dg-final { scan-tree-dump-not "fail_func" "optimized" } }