1d08606817a3c8f36441247451c1c9a19abeebd5eDmitri Gribenko// RUN: %clang_cc1 -fsyntax-only -pedantic -verify %s 2ba5f6eced29937e4e4851a2c0980744768413d66Nick Lewycky// RUN: cp %s %t 3d08606817a3c8f36441247451c1c9a19abeebd5eDmitri Gribenko// RUN: not %clang_cc1 -pedantic -fixit -x c %t 4176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines// RUN: %clang_cc1 -pedantic -Werror -Wno-invalid-noreturn -x c %t 5a3a835149ed4b183e3b009a1f94a6123779d696bDouglas Gregor 6a3a835149ed4b183e3b009a1f94a6123779d696bDouglas Gregor/* This is a test of the various code modification hints that are 7fe057ac36b9a76cdfa37dfa003f986461fb5fb98Douglas Gregor provided as part of warning or extension diagnostics. All of the 8fe057ac36b9a76cdfa37dfa003f986461fb5fb98Douglas Gregor warnings will be fixed by -fixit, and the resulting file should 9fe057ac36b9a76cdfa37dfa003f986461fb5fb98Douglas Gregor compile cleanly with -Werror -pedantic. */ 10fe057ac36b9a76cdfa37dfa003f986461fb5fb98Douglas Gregor 11a3a835149ed4b183e3b009a1f94a6123779d696bDouglas Gregorstruct s; // expected-note{{previous use is here}} 12a3a835149ed4b183e3b009a1f94a6123779d696bDouglas Gregor 13a3a835149ed4b183e3b009a1f94a6123779d696bDouglas Gregorunion s *s1; // expected-error{{use of 's' with tag type that does not match previous declaration}} 143f0b5fd3a55baf1e3e768fe981bcc3ad5e209ec1Douglas Gregor 153f0b5fd3a55baf1e3e768fe981bcc3ad5e209ec1Douglas Gregorstruct Point { 163f0b5fd3a55baf1e3e768fe981bcc3ad5e209ec1Douglas Gregor float x, y, z; 173f0b5fd3a55baf1e3e768fe981bcc3ad5e209ec1Douglas Gregor}; 183f0b5fd3a55baf1e3e768fe981bcc3ad5e209ec1Douglas Gregor 193f0b5fd3a55baf1e3e768fe981bcc3ad5e209ec1Douglas Gregorstruct Point *get_origin(); 203f0b5fd3a55baf1e3e768fe981bcc3ad5e209ec1Douglas Gregor 213f0b5fd3a55baf1e3e768fe981bcc3ad5e209ec1Douglas Gregorvoid test_point() { 22d08606817a3c8f36441247451c1c9a19abeebd5eDmitri Gribenko (void)get_origin->x; // expected-error {{base of member reference is a function; perhaps you meant to call it with no arguments?}} 233f0b5fd3a55baf1e3e768fe981bcc3ad5e209ec1Douglas Gregor} 24176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines 254967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar// These errors require C11. 264967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#if __STDC_VERSION__ > 199901L 27176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hinesvoid noreturn_1() _Noreturn; // expected-error {{must precede function declarator}} 28176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hinesvoid noreturn_1() { 29176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines return; // expected-warning {{should not return}} 30176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines} 31176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hinesvoid noreturn_2() _Noreturn { // expected-error {{must precede function declarator}} 32176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines return; // expected-warning {{should not return}} 33176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines} 344967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#endif 35