1 // RUN: %clang_cc1 -fsyntax-only -verify %s -Wmissing-noreturn 2 void f() __attribute__((noreturn)); 3 4 template<typename T> void g(T) { // expected-warning {{function could be attribute 'noreturn'}} 5 f(); 6 } 7 8 template void g<int>(int); // expected-note {{in instantiation of function template specialization 'g<int>' requested here}} 9 10 template<typename T> struct A { 11 void g() { // expected-warning {{function could be attribute 'noreturn'}} 12 f(); 13 } 14 }; 15 16 template struct A<int>; // expected-note {{in instantiation of member function 'A<int>::g' requested here}} 17 18 struct B { 19 template<typename T> void g(T) { // expected-warning {{function could be attribute 'noreturn'}} 20 f(); 21 } 22 }; 23 24 template void B::g<int>(int); // expected-note {{in instantiation of function template specialization 'B::g<int>' requested here}} 25 26 // We don't want a warning here. 27 struct X { 28 virtual void g() { f(); } 29 }; 30 31 namespace test1 { 32 bool condition(); 33 34 // We don't want a warning here. 35 void foo() { 36 while (condition()) {} 37 } 38 } 39 40 41 // <rdar://problem/7880658> - This test case previously had a false "missing return" 42 // warning. 43 struct R7880658 { 44 R7880658 &operator++(); 45 bool operator==(const R7880658 &) const; 46 bool operator!=(const R7880658 &) const; 47 }; 48 49 void f_R7880658(R7880658 f, R7880658 l) { // no-warning 50 for (; f != l; ++f) { 51 } 52 } 53