summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-02-28 18:30:25 +0000
committerDouglas Gregor <dgregor@apple.com>2010-02-28 18:30:25 +0000
commite489a7d3d397214a43d587d88378f3df642aba60 (patch)
treee6ffcf44f1d49a62fc36fc58c4c148f1f635f3bb /clang/test
parentfd48afe412e6a07e248f528d2650abe7c25b714a (diff)
downloadbcm5719-llvm-e489a7d3d397214a43d587d88378f3df642aba60.tar.gz
bcm5719-llvm-e489a7d3d397214a43d587d88378f3df642aba60.zip
Warn about the deprecated string literal -> char* conversion. Fixes PR6428.
llvm-svn: 97404
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p3.cpp5
-rw-r--r--clang/test/SemaCXX/dcl_init_aggr.cpp2
-rw-r--r--clang/test/SemaCXX/overload-call.cpp6
-rw-r--r--clang/test/SemaCXX/type-convert-construct.cpp4
4 files changed, 9 insertions, 8 deletions
diff --git a/clang/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p3.cpp b/clang/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p3.cpp
index 95f9640a0b4..dc79300af33 100644
--- a/clang/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p3.cpp
+++ b/clang/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p3.cpp
@@ -3,8 +3,9 @@
template<class X, class Y, class Z> X f(Y,Z); // expected-note {{candidate template ignored: couldn't infer template argument 'X'}}
void g() {
- f<int,char*,double>("aa",3.0);
- f<int,char*>("aa",3.0); // Z is deduced to be double
+ f<int,char*,double>("aa",3.0); // expected-warning{{conversion from string literal to 'char *' is deprecated}}
+ f<int,char*>("aa",3.0); // Z is deduced to be double \
+ // expected-warning{{conversion from string literal to 'char *' is deprecated}}
f<int>("aa",3.0); // Y is deduced to be char*, and
// Z is deduced to be double
f("aa",3.0); // expected-error{{no matching}}
diff --git a/clang/test/SemaCXX/dcl_init_aggr.cpp b/clang/test/SemaCXX/dcl_init_aggr.cpp
index 861eb3dcb16..461c60b5bbc 100644
--- a/clang/test/SemaCXX/dcl_init_aggr.cpp
+++ b/clang/test/SemaCXX/dcl_init_aggr.cpp
@@ -38,7 +38,7 @@ char cv[4] = { 'a', 's', 'd', 'f', 0 }; // expected-error{{excess elements in ar
// C++ [dcl.init.aggr]p7
struct TooFew { int a; char* b; int c; };
-TooFew too_few = { 1, "asdf" }; // okay
+TooFew too_few = { 1, "asdf" }; // expected-warning{{conversion from string literal to 'char *' is deprecated}}
struct NoDefaultConstructor { // expected-note 3 {{candidate constructor (the implicit copy constructor)}} \
// expected-note{{declared here}}
diff --git a/clang/test/SemaCXX/overload-call.cpp b/clang/test/SemaCXX/overload-call.cpp
index 364011c9172..77e0908ef46 100644
--- a/clang/test/SemaCXX/overload-call.cpp
+++ b/clang/test/SemaCXX/overload-call.cpp
@@ -53,7 +53,7 @@ int* k(char*);
double* k(bool);
void test_k() {
- int* ip1 = k("foo");
+ int* ip1 = k("foo"); // expected-warning{{conversion from string literal to 'char *' is deprecated}}
double* dp1 = k(L"foo");
}
@@ -61,7 +61,7 @@ int* l(wchar_t*);
double* l(bool);
void test_l() {
- int* ip1 = l(L"foo");
+ int* ip1 = l(L"foo"); // expected-warning{{conversion from string literal to 'wchar_t *' is deprecated}}
double* dp1 = l("foo");
}
@@ -79,7 +79,7 @@ class E;
void test_n(E* e) {
char ca[7];
int* ip1 = n(ca);
- int* ip2 = n("foo");
+ int* ip2 = n("foo"); // expected-warning{{conversion from string literal to 'char *' is deprecated}}
float fa[7];
double* dp1 = n(fa);
diff --git a/clang/test/SemaCXX/type-convert-construct.cpp b/clang/test/SemaCXX/type-convert-construct.cpp
index d786a9a8a6f..8f92a035dc7 100644
--- a/clang/test/SemaCXX/type-convert-construct.cpp
+++ b/clang/test/SemaCXX/type-convert-construct.cpp
@@ -11,7 +11,7 @@ void f() {
int *p;
bool v6 = T(0) == p;
char *str;
- str = "a string";
+ str = "a string"; // expected-warning{{conversion from string literal to 'char *' is deprecated}}
wchar_t *wstr;
- wstr = L"a wide string";
+ wstr = L"a wide string"; // expected-warning{{conversion from string literal to 'wchar_t *' is deprecated}}
}
OpenPOWER on IntegriCloud