PR c++/85553
[official-gcc.git] / gcc / testsuite / g++.dg / ext / attr-noreturn-3.C
blob819ed3276102a77f64d718cc10f4ab2a7c3734ab
1 /*  PR c++/84294 - attributes on a function template redeclaration silently
2     discarded
3     { dg-do compile }
4     { dg-options "-O -fdump-tree-optimized" } */
6 typedef void Func ();
8 template <Func>
9 void fail_func ();
11 template <Func test>
12 int test_func ()
14   test ();
16   // Should be eliminated.
17   fail_func<test> ();
19   // Expect no -Wreturn type here despite the absence of a return
20   // statement in a non-void function.
21 }   // { dg-bogus "\\\[-Wreturn-type]" "bug 84621" { xfail *-*-* } }
23 void __attribute__ ((noreturn)) func_noreturn_none ();
24 void func_noreturn_none ();
26 template int test_func<func_noreturn_none>();
29 void func_none_noreturn ();
30 void  __attribute__ ((noreturn)) func_none_noreturn ();
32 template int test_func<func_none_noreturn>();
35 template <class>
36 void __attribute__ ((noreturn)) templ_noreturn_none ();
38 template <class>
39 void templa_noreturn_none ();
41 template int test_func<templ_noreturn_none<int> >();
44 template <class>
45 void templ_none_noreturn ();
47 template <class>
48 void  __attribute__ ((noreturn)) templ_none_noreturn ();
50 template int test_func<templ_none_noreturn<int> >();
53 // Verify that calls to fail_func() specializations have been eliminated.
54 // { dg-final { scan-tree-dump-not "fail_func" "optimized" } }