2015-12-10 09:07:17 +08:00
|
|
|
// RUN: %clang_cc1 -fsyntax-only -verify %s -DWARNING
|
|
|
|
// RUN: %clang_cc1 -fsyntax-only -std=c++98 -verify %s -DWARNING
|
|
|
|
// RUN: %clang_cc1 -fsyntax-only -std=c++98 -Wno-deprecated-writable-strings -verify %s
|
|
|
|
// RUN: %clang_cc1 -fsyntax-only -std=c++98 -Wno-deprecated -Wdeprecated-increment-bool -verify %s
|
|
|
|
// RUN: %clang_cc1 -fsyntax-only -std=c++98 -fwritable-strings -verify %s
|
|
|
|
// RUN: %clang_cc1 -fsyntax-only -std=c++98 -Wno-write-strings -verify %s
|
|
|
|
// RUN: %clang_cc1 -fsyntax-only -std=c++98 -Werror=c++11-compat -verify %s -DERROR
|
|
|
|
// RUN: %clang_cc1 -fsyntax-only -std=c++98 -Werror=deprecated -Wno-error=deprecated-increment-bool -verify %s -DERROR
|
|
|
|
// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s -DWARNING
|
|
|
|
// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s -Wno-deprecated -Wdeprecated-increment-bool -DWARNING
|
2014-04-22 09:11:06 +08:00
|
|
|
// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s -pedantic-errors -DERROR
|
2011-01-07 02:45:19 +08:00
|
|
|
// rdar://8827606
|
|
|
|
|
|
|
|
char *fun(void)
|
|
|
|
{
|
|
|
|
return "foo";
|
2015-12-10 09:07:17 +08:00
|
|
|
#if defined(ERROR)
|
2014-04-22 09:11:06 +08:00
|
|
|
#if __cplusplus >= 201103L
|
|
|
|
// expected-error@-3 {{ISO C++11 does not allow conversion from string literal to 'char *'}}
|
|
|
|
#else
|
2015-12-10 09:07:17 +08:00
|
|
|
// expected-error@-5 {{conversion from string literal to 'char *' is deprecated}}
|
|
|
|
#endif
|
|
|
|
#elif defined(WARNING)
|
|
|
|
#if __cplusplus >= 201103L
|
|
|
|
// expected-warning@-9 {{ISO C++11 does not allow conversion from string literal to 'char *'}}
|
|
|
|
#else
|
|
|
|
// expected-warning@-11 {{conversion from string literal to 'char *' is deprecated}}
|
2014-04-22 09:11:06 +08:00
|
|
|
#endif
|
2013-11-15 06:22:31 +08:00
|
|
|
#endif
|
2011-01-07 02:45:19 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void test(bool b)
|
|
|
|
{
|
|
|
|
++b; // expected-warning {{incrementing expression of type bool is deprecated}}
|
|
|
|
}
|