summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/SemaCXX/condition.cpp8
-rw-r--r--clang/test/SemaCXX/cxx11-crashes.cpp4
-rw-r--r--clang/test/SemaCXX/for-range-unused.cpp4
-rw-r--r--clang/test/SemaTemplate/dependent-names.cpp21
4 files changed, 28 insertions, 9 deletions
diff --git a/clang/test/SemaCXX/condition.cpp b/clang/test/SemaCXX/condition.cpp
index d8058811948..73f3dceef64 100644
--- a/clang/test/SemaCXX/condition.cpp
+++ b/clang/test/SemaCXX/condition.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
void test() {
int x;
@@ -6,7 +6,7 @@ void test() {
if (int x=0) ++x;
typedef int arr[10];
- while (arr x=0) ; // expected-error {{an array type is not allowed here}} expected-error {{array initializer must be an initializer list}}
+ while (arr x={0}) ; // expected-error {{an array type is not allowed here}}
while (int f()=0) ; // expected-error {{a function type is not allowed here}}
struct S {} s;
@@ -19,9 +19,7 @@ void test() {
while (struct NewS *x=0) ;
while (struct S {} *x=0) ; // expected-error {{types may not be defined in conditions}}
while (struct {} *x=0) ; // expected-error {{types may not be defined in conditions}}
- switch (enum {E} x=0) ; // expected-error {{types may not be defined in conditions}} \
- // expected-warning{{enumeration value 'E' not handled in switch}} expected-warning {{switch statement has empty body}} \
- // expected-note{{put the semicolon on a separate line}}
+ switch (enum {E} x=0) ; // expected-error {{types may not be defined in conditions}}
if (int x=0) { // expected-note 2 {{previous definition is here}}
int x; // expected-error {{redefinition of 'x'}}
diff --git a/clang/test/SemaCXX/cxx11-crashes.cpp b/clang/test/SemaCXX/cxx11-crashes.cpp
index bd51af1da2f..a4d4829f3fc 100644
--- a/clang/test/SemaCXX/cxx11-crashes.cpp
+++ b/clang/test/SemaCXX/cxx11-crashes.cpp
@@ -70,7 +70,9 @@ namespace b6981007 {
for (auto x : s) {
// We used to attempt to evaluate the initializer of this variable,
// and crash because it has an undeduced type.
- const int &n(x);
+ // FIXME: We should set the loop variable to be invalid if we can't build
+ // the loop, to suppress this follow-on error.
+ const int &n(x); // expected-error {{could not bind to an lvalue of type 'auto'}}
}
}
}
diff --git a/clang/test/SemaCXX/for-range-unused.cpp b/clang/test/SemaCXX/for-range-unused.cpp
index ce6b379cc19..ec11015552e 100644
--- a/clang/test/SemaCXX/for-range-unused.cpp
+++ b/clang/test/SemaCXX/for-range-unused.cpp
@@ -7,7 +7,7 @@ template <typename T>
void doIt() {
int a; // expected-warning {{unused variable 'a'}}
- for (auto& e : elements)
+ for (auto& e : elements) // expected-warning {{unused variable 'e'}}
;
}
@@ -17,5 +17,5 @@ template <typename T>
int main(int, char**) {
Vector<int> vector;
- vector.doIt();
+ vector.doIt(); // expected-note {{here}}
}
diff --git a/clang/test/SemaTemplate/dependent-names.cpp b/clang/test/SemaTemplate/dependent-names.cpp
index eb75e69ef4d..fa47ef53581 100644
--- a/clang/test/SemaTemplate/dependent-names.cpp
+++ b/clang/test/SemaTemplate/dependent-names.cpp
@@ -264,7 +264,7 @@ namespace PR10053 {
}
namespace PR10187 {
- namespace A {
+ namespace A1 {
template<typename T>
struct S {
void f() {
@@ -278,6 +278,25 @@ namespace PR10187 {
}
}
+ namespace A2 {
+ template<typename T>
+ struct S {
+ void f() {
+ for (auto &a : e)
+ __range(a); // expected-error {{undeclared identifier '__range'}}
+ }
+ T e[10];
+ };
+ void g() {
+ S<int>().f(); // expected-note {{here}}
+ }
+ struct X {};
+ void __range(X);
+ void h() {
+ S<X>().f();
+ }
+ }
+
namespace B {
template<typename T> void g(); // expected-note {{not viable}}
template<typename T> void f() {
OpenPOWER on IntegriCloud