blob: 1335c765b3d2c035dd0b4eb5644145dd06395935 [file] [log] [blame]
Daniel Dunbard7d5f022009-03-24 02:24:46 +00001// RUN: clang-cc -verify -fsyntax-only %s
Daniel Dunbard3f2c102008-10-19 02:04:16 +00002
3static void (*fp0)(void) __attribute__((noreturn));
4
5static void __attribute__((noreturn)) f0(void) {
6 fatal();
7}
8
9// On K&R
10int f1() __attribute__((noreturn));
11
12int g0 __attribute__((noreturn)); // expected-warning {{'noreturn' attribute only applies to function types}}
13
14int f2() __attribute__((noreturn(1, 2))); // expected-error {{attribute requires 0 argument(s)}}
Mike Stumpf7c41da2009-04-29 00:43:21 +000015
16void f3() __attribute__((noreturn));
17
18void f3() {
19 return; // expected-error {{function 'f3' declared 'noreturn' should not return}}
20}
21