PR c++/83871
[official-gcc.git] / gcc / testsuite / g++.dg / ext / attr-noreturn-2.C
blobb35245cc9cca8a1088836d227c85a6d3bbb4a0b3
1 /*  PR c++/83871 - wrong code for attribute const and pure on distinct
2     template specializations
3     Test to verify that attributes noreturn on multiple declarations of
4     the same function are merged.
5     { dg-do compile }
6     { dg-options "-O -fdump-tree-optimized" } */
8 int __attribute__ ((noreturn)) fnoreturn ();
10 void fnoreturn_failed ();
12 int test_noreturn () throw ()
14   fnoreturn ();
15   fnoreturn_failed ();
16   // Verify that the call to fnoreturn_failed() is eliminated.
17   // { dg-final { scan-tree-dump-not "fnoreturn_failed" "optimized" } }
19   // Expect no -Wreturn-type warning despite the absence of a return
20   // statement in a non-void function.
24 int __attribute__ ((noreturn)) fnoreturn_none ();
25 int fnoreturn_none ();
27 void fnoreturn_none_failed ();
30 int test_noreturn_none ()
32   fnoreturn_none ();
33   fnoreturn_none_failed ();
34   // { dg-final { scan-tree-dump-not "fnoreturn_none_failed" "optimized" } }
37 int fnone_noreturn ();
38 int __attribute__ ((noreturn)) fnone_noreturn ();
40 void fnone_noreturn_failed ();
42 int test_none_noreturn () throw ()
44   fnone_noreturn ();
45   fnone_noreturn_failed ();
46   // { dg-final { scan-tree-dump-not "fnone_noreturn_failed" "optimized" } }