Reid Kleckner | e8bcd4c | 2013-09-10 22:21:37 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify %s |
| 2 | |
| 3 | // Split from function-template-specialization.cpp because the noreturn warning |
| 4 | // requires analysis-based warnings, which the other errors in that test case |
| 5 | // disable. |
| 6 | |
| 7 | template <int N> void __attribute__((noreturn)) f3() { __builtin_unreachable(); } |
| 8 | template <> void f3<1>() { } // expected-warning {{function declared 'noreturn' should not return}} |
Stephen Hines | 0e2c34f | 2015-03-23 12:09:02 -0700 | [diff] [blame] | 9 | |
| 10 | #if __cplusplus >= 201103L |
| 11 | namespace PR21942 { |
| 12 | template <int> |
| 13 | struct A { |
| 14 | void foo[[noreturn]](); |
| 15 | }; |
| 16 | |
| 17 | template <> |
| 18 | void A<0>::foo() {} // expected-warning{{function declared 'noreturn' should not return}} |
| 19 | } |
| 20 | #endif |