xref: /minix3/external/bsd/llvm/dist/clang/test/SemaCXX/writable-strings-deprecated.cpp (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -Wno-deprecated-writable-strings -verify %s
2*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -Wno-deprecated -Wdeprecated-increment-bool -verify %s
3f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -fwritable-strings -verify %s
4f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -Wno-write-strings -verify %s
5f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -Werror=c++11-compat -verify %s -DERROR
6*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -Werror=deprecated -Wno-error=deprecated-increment-bool -verify %s -DERROR
7*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s
8*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s -Wno-deprecated -Wdeprecated-increment-bool
9*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s -pedantic-errors -DERROR
10f4a2713aSLionel Sambuc // rdar://8827606
11f4a2713aSLionel Sambuc 
fun(void)12f4a2713aSLionel Sambuc char *fun(void)
13f4a2713aSLionel Sambuc {
14f4a2713aSLionel Sambuc    return "foo";
15*0a6a1f1dSLionel Sambuc #if __cplusplus >= 201103L
16f4a2713aSLionel Sambuc #ifdef ERROR
17*0a6a1f1dSLionel Sambuc    // expected-error@-3 {{ISO C++11 does not allow conversion from string literal to 'char *'}}
18*0a6a1f1dSLionel Sambuc #else
19*0a6a1f1dSLionel Sambuc    // expected-warning@-5 {{ISO C++11 does not allow conversion from string literal to 'char *'}}
20*0a6a1f1dSLionel Sambuc #endif
21*0a6a1f1dSLionel Sambuc #elif defined(ERROR)
22*0a6a1f1dSLionel Sambuc    // expected-error@-8 {{deprecated}}
23f4a2713aSLionel Sambuc #endif
24f4a2713aSLionel Sambuc }
25f4a2713aSLionel Sambuc 
test(bool b)26f4a2713aSLionel Sambuc void test(bool b)
27f4a2713aSLionel Sambuc {
28f4a2713aSLionel Sambuc   ++b; // expected-warning {{incrementing expression of type bool is deprecated}}
29f4a2713aSLionel Sambuc }
30