37 lines · cpp
1// RUN: %clang_cc1 -fsyntax-only -verify %std_cxx14- %s -DWARNING2// RUN: %clang_cc1 -fsyntax-only -std=c++98 -verify %s -DWARNING3// RUN: %clang_cc1 -fsyntax-only -std=c++98 -Wno-deprecated-writable-strings -verify %s4// RUN: %clang_cc1 -fsyntax-only -std=c++98 -Wno-deprecated -Wdeprecated-increment-bool -verify %s5// RUN: %clang_cc1 -fsyntax-only -std=c++98 -fwritable-strings -verify %s6// RUN: %clang_cc1 -fsyntax-only -std=c++98 -Wno-write-strings -verify %s7// RUN: %clang_cc1 -fsyntax-only -std=c++98 -Werror=c++11-compat -verify %s -DERROR8// RUN: %clang_cc1 -fsyntax-only -std=c++98 -Werror=deprecated -Wno-error=deprecated-increment-bool -verify %s -DERROR9// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s -DWARNING10// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s -Wno-deprecated -Wdeprecated-increment-bool -DWARNING11// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s -pedantic-errors -DERROR12 13char *fun(void)14{15 return "foo";16#if defined(ERROR)17#if __cplusplus >= 201103L18 // expected-error@-3 {{ISO C++11 does not allow conversion from string literal to 'char *'}}19#else20 // expected-error@-5 {{conversion from string literal to 'char *' is deprecated}}21#endif22#elif defined(WARNING)23#if __cplusplus >= 201103L24 // expected-warning@-9 {{ISO C++11 does not allow conversion from string literal to 'char *'}}25#else26 // expected-warning@-11 {{conversion from string literal to 'char *' is deprecated}}27#endif28#endif29}30 31#if __cplusplus < 201703L32void test(bool b)33{34 ++b; // expected-warning {{incrementing expression of type bool is deprecated}}35}36#endif37