r290262 - Make some diagnostic tests C++11 clean.
Paul Robinson via cfe-commits
cfe-commits at lists.llvm.org
Wed Dec 21 10:33:17 PST 2016
Author: probinson
Date: Wed Dec 21 12:33:17 2016
New Revision: 290262
URL: http://llvm.org/viewvc/llvm-project?rev=290262&view=rev
Log:
Make some diagnostic tests C++11 clean.
Differential Revision: http://reviews.llvm.org/D27794
Modified:
cfe/trunk/test/FixIt/fixit.cpp
cfe/trunk/test/Parser/backtrack-off-by-one.cpp
cfe/trunk/test/SemaCXX/copy-assignment.cpp
Modified: cfe/trunk/test/FixIt/fixit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/FixIt/fixit.cpp?rev=290262&r1=290261&r2=290262&view=diff
==============================================================================
--- cfe/trunk/test/FixIt/fixit.cpp (original)
+++ cfe/trunk/test/FixIt/fixit.cpp Wed Dec 21 12:33:17 2016
@@ -1,8 +1,12 @@
-// RUN: %clang_cc1 -pedantic -Wall -Wno-comment -verify -fcxx-exceptions -x c++ %s
+// RUN: %clang_cc1 -pedantic -Wall -Wno-comment -verify -fcxx-exceptions -x c++ -std=c++98 %s
+// RUN: cp %s %t-98
+// RUN: not %clang_cc1 -pedantic -Wall -Wno-comment -fcxx-exceptions -fixit -x c++ -std=c++98 %t-98
+// RUN: %clang_cc1 -fsyntax-only -pedantic -Wall -Werror -Wno-comment -fcxx-exceptions -x c++ -std=c++98 %t-98
// RUN: not %clang_cc1 -fsyntax-only -fdiagnostics-parseable-fixits -x c++ -std=c++11 %s 2>&1 | FileCheck %s
-// RUN: cp %s %t
-// RUN: not %clang_cc1 -pedantic -Wall -Wno-comment -fcxx-exceptions -fixit -x c++ %t
-// RUN: %clang_cc1 -fsyntax-only -pedantic -Wall -Werror -Wno-comment -fcxx-exceptions -x c++ %t
+// RUN: %clang_cc1 -pedantic -Wall -Wno-comment -verify -fcxx-exceptions -x c++ -std=c++11 %s
+// RUN: cp %s %t-11
+// RUN: not %clang_cc1 -pedantic -Wall -Wno-comment -fcxx-exceptions -fixit -x c++ -std=c++11 %t-11
+// RUN: %clang_cc1 -fsyntax-only -pedantic -Wall -Werror -Wno-comment -fcxx-exceptions -x c++ -std=c++11 %t-11
/* This is a test of the various code modification hints that are
provided as part of warning or extension diagnostics. All of the
@@ -21,7 +25,11 @@ static void C1::g() { } // expected-erro
template<int Value> struct CT { template<typename> struct Inner; }; // expected-note{{previous use is here}}
+// FIXME: In C++11 this gets 'expected unqualified-id' which fixit can't fix.
+// Probably parses as `CT<10> > 2 > ct;` rather than `CT<(10 >> 2)> ct;`.
+#if __cplusplus < 201103L
CT<10 >> 2> ct; // expected-warning{{require parentheses}}
+#endif
class C3 {
public:
@@ -41,7 +49,11 @@ protected:
};
class B : public A {
+#if __cplusplus >= 201103L
+ A::foo; // expected-error{{ISO C++11 does not allow access declarations}}
+#else
A::foo; // expected-warning{{access declarations are deprecated}}
+#endif
};
void f() throw(); // expected-note{{previous}}
@@ -285,8 +297,10 @@ namespace greatergreater {
void (*p)() = &t<int>;
(void)(&t<int>==p); // expected-error {{use '> ='}}
(void)(&t<int>>=p); // expected-error {{use '> >'}}
+#if __cplusplus < 201103L
(void)(&t<S<int>>>=p); // expected-error {{use '> >'}}
(Shr)&t<S<int>>>>=p; // expected-error {{use '> >'}}
+#endif
// FIXME: We correct this to '&t<int> > >= p;' not '&t<int> >>= p;'
//(Shr)&t<int>>>=p;
Modified: cfe/trunk/test/Parser/backtrack-off-by-one.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/backtrack-off-by-one.cpp?rev=290262&r1=290261&r2=290262&view=diff
==============================================================================
--- cfe/trunk/test/Parser/backtrack-off-by-one.cpp (original)
+++ cfe/trunk/test/Parser/backtrack-off-by-one.cpp Wed Dec 21 12:33:17 2016
@@ -1,4 +1,6 @@
// RUN: %clang_cc1 -verify %s
+// RUN: %clang_cc1 -verify %s -std=c++98
+// RUN: %clang_cc1 -verify %s -std=c++11
// PR25946
// We had an off-by-one error in an assertion when annotating A<int> below. Our
@@ -10,8 +12,10 @@ template <typename T> class A {};
// expected-error at +1 {{expected '{' after base class list}}
template <typename T> class B : T // not ',' or '{'
-// expected-error at +3 {{C++ requires a type specifier for all declarations}}
-// expected-error at +2 {{expected ';' after top level declarator}}
+#if __cplusplus < 201103L
+// expected-error at +4 {{expected ';' after top level declarator}}
+#endif
+// expected-error at +2 {{C++ requires a type specifier for all declarations}}
// expected-error at +1 {{expected ';' after class}}
A<int> {
};
Modified: cfe/trunk/test/SemaCXX/copy-assignment.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/copy-assignment.cpp?rev=290262&r1=290261&r2=290262&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/copy-assignment.cpp (original)
+++ cfe/trunk/test/SemaCXX/copy-assignment.cpp Wed Dec 21 12:33:17 2016
@@ -1,4 +1,11 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++98
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11
+
+#if __cplusplus >= 201103L
+// expected-note at +3 2 {{candidate constructor}}
+// expected-note at +2 {{passing argument to parameter here}}
+#endif
struct A {
};
@@ -7,6 +14,9 @@ struct ConvertibleToA {
};
struct ConvertibleToConstA {
+#if __cplusplus >= 201103L
+// expected-note at +2 {{candidate function}}
+#endif
operator const A();
};
@@ -69,6 +79,9 @@ void test() {
na = a;
na = constA;
na = convertibleToA;
+#if __cplusplus >= 201103L
+// expected-error at +2 {{no viable conversion}}
+#endif
na = convertibleToConstA;
na += a; // expected-error{{no viable overloaded '+='}}
More information about the cfe-commits
mailing list