| 1 |
/* PR c++/83871 - wrong code for attribute const and pure on distinct |
| 2 |
template specializations |
| 3 |
Test to verify that attributes nothrow on multiple declarations of |
| 4 |
the same function are merged. |
| 5 |
{ dg-do compile } |
| 6 |
{ dg-options "-O -fdump-tree-eh" } */ |
| 7 |
|
| 8 |
void __attribute__ ((nothrow)) fnothrow (); |
| 9 |
|
| 10 |
void test_nothrow () throw () |
| 11 |
{ |
| 12 |
// No exception handling necessary around the call to fnothrow(). |
| 13 |
fnothrow (); |
| 14 |
} |
| 15 |
|
| 16 |
void __attribute__ ((nothrow)) fnothrow_none (); |
| 17 |
void fnothrow_none (); |
| 18 |
|
| 19 |
void test_nothrow_none () throw () |
| 20 |
{ |
| 21 |
// No exception handling necessary around the call to fnothrow_none(). |
| 22 |
fnothrow_none (); |
| 23 |
} |
| 24 |
|
| 25 |
void fnone_nothrow (); |
| 26 |
void __attribute__ ((nothrow)) fnone_nothrow (); |
| 27 |
|
| 28 |
void test_none_nothrow () throw () |
| 29 |
{ |
| 30 |
// No exception handling necessary around the call to fnone_nothrow(). |
| 31 |
fnone_nothrow (); |
| 32 |
} |
| 33 |
|
| 34 |
int __attribute__ ((nothrow)) fnothrow_noreturn_none (); |
| 35 |
int __attribute__ ((noreturn)) fnothrow_noreturn_none (); |
| 36 |
int fnothrow_noreturn_none (); |
| 37 |
|
| 38 |
int test_nothrow_noreturn_none () throw () |
| 39 |
{ |
| 40 |
// No exception handling necessary around the call(). |
| 41 |
// No -Wreturn-value should be emitted because the function is |
| 42 |
// declared noreturn. |
| 43 |
fnothrow_noreturn_none (); |
| 44 |
} |
| 45 |
|
| 46 |
// Verify that no exception handling code was emitted. |
| 47 |
// { dg-final { scan-tree-dump-not "eh_dispatch" "eh" } } |
| 48 |
// { dg-final { scan-tree-dump-not "resx" "eh" } } |