| 1 |
/* PR 2743 */ |
| 2 |
/* { dg-do compile } */ |
| 3 |
|
| 4 |
namespace ns { |
| 5 |
class Exception |
| 6 |
{ |
| 7 |
}; |
| 8 |
} |
| 9 |
|
| 10 |
namespace ns |
| 11 |
{ |
| 12 |
class Test { |
| 13 |
public: |
| 14 |
inline Test() |
| 15 |
#if __cplusplus <= 201402L |
| 16 |
throw( Exception ) // { dg-warning "deprecated" "" { target { c++11 && { ! c++17 } } } } |
| 17 |
#endif |
| 18 |
; |
| 19 |
inline Test(int n ) |
| 20 |
#if __cplusplus <= 201402L |
| 21 |
throw( Exception ) // { dg-warning "deprecated" "" { target { c++11 && { ! c++17 } } } } |
| 22 |
#endif |
| 23 |
; |
| 24 |
private: |
| 25 |
int i; |
| 26 |
}; |
| 27 |
} |
| 28 |
|
| 29 |
// This line used to fail because Exception wasn't looked up in the |
| 30 |
// right scope. |
| 31 |
ns::Test::Test() |
| 32 |
#if __cplusplus <= 201402L |
| 33 |
throw( Exception ) // { dg-warning "deprecated" "" { target { c++11 && { ! c++17 } } } } |
| 34 |
#endif |
| 35 |
: i( 1 ) |
| 36 |
{ |
| 37 |
} |
| 38 |
|
| 39 |
ns::Test::Test( int n ) |
| 40 |
#if __cplusplus <= 201402L |
| 41 |
throw( Exception ) // { dg-warning "deprecated" "" { target { c++11 && { ! c++17 } } } } |
| 42 |
#endif |
| 43 |
: i( n ) |
| 44 |
{ |
| 45 |
} |
| 46 |
|
| 47 |
int main(int argc, char* argv[]) { |
| 48 |
ns::Test test; |
| 49 |
} |