Skip to content
This repository was archived by the owner on Nov 1, 2021. It is now read-only.

Commit b94950e

Browse files
committed
Make some diagnostic tests C++11 clean.
Differential Revision: http://reviews.llvm.org/D27794 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@290262 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 868b081 commit b94950e

File tree

3 files changed

+38
-7
lines changed

3 files changed

+38
-7
lines changed

test/FixIt/fixit.cpp

+18-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1-
// RUN: %clang_cc1 -pedantic -Wall -Wno-comment -verify -fcxx-exceptions -x c++ %s
1+
// RUN: %clang_cc1 -pedantic -Wall -Wno-comment -verify -fcxx-exceptions -x c++ -std=c++98 %s
2+
// RUN: cp %s %t-98
3+
// RUN: not %clang_cc1 -pedantic -Wall -Wno-comment -fcxx-exceptions -fixit -x c++ -std=c++98 %t-98
4+
// RUN: %clang_cc1 -fsyntax-only -pedantic -Wall -Werror -Wno-comment -fcxx-exceptions -x c++ -std=c++98 %t-98
25
// RUN: not %clang_cc1 -fsyntax-only -fdiagnostics-parseable-fixits -x c++ -std=c++11 %s 2>&1 | FileCheck %s
3-
// RUN: cp %s %t
4-
// RUN: not %clang_cc1 -pedantic -Wall -Wno-comment -fcxx-exceptions -fixit -x c++ %t
5-
// RUN: %clang_cc1 -fsyntax-only -pedantic -Wall -Werror -Wno-comment -fcxx-exceptions -x c++ %t
6+
// RUN: %clang_cc1 -pedantic -Wall -Wno-comment -verify -fcxx-exceptions -x c++ -std=c++11 %s
7+
// RUN: cp %s %t-11
8+
// RUN: not %clang_cc1 -pedantic -Wall -Wno-comment -fcxx-exceptions -fixit -x c++ -std=c++11 %t-11
9+
// RUN: %clang_cc1 -fsyntax-only -pedantic -Wall -Werror -Wno-comment -fcxx-exceptions -x c++ -std=c++11 %t-11
610

711
/* This is a test of the various code modification hints that are
812
provided as part of warning or extension diagnostics. All of the
@@ -21,7 +25,11 @@ static void C1::g() { } // expected-error{{'static' can only be specified inside
2125

2226
template<int Value> struct CT { template<typename> struct Inner; }; // expected-note{{previous use is here}}
2327

28+
// FIXME: In C++11 this gets 'expected unqualified-id' which fixit can't fix.
29+
// Probably parses as `CT<10> > 2 > ct;` rather than `CT<(10 >> 2)> ct;`.
30+
#if __cplusplus < 201103L
2431
CT<10 >> 2> ct; // expected-warning{{require parentheses}}
32+
#endif
2533

2634
class C3 {
2735
public:
@@ -41,7 +49,11 @@ class A {
4149
};
4250

4351
class B : public A {
52+
#if __cplusplus >= 201103L
53+
A::foo; // expected-error{{ISO C++11 does not allow access declarations}}
54+
#else
4455
A::foo; // expected-warning{{access declarations are deprecated}}
56+
#endif
4557
};
4658

4759
void f() throw(); // expected-note{{previous}}
@@ -285,8 +297,10 @@ namespace greatergreater {
285297
void (*p)() = &t<int>;
286298
(void)(&t<int>==p); // expected-error {{use '> ='}}
287299
(void)(&t<int>>=p); // expected-error {{use '> >'}}
300+
#if __cplusplus < 201103L
288301
(void)(&t<S<int>>>=p); // expected-error {{use '> >'}}
289302
(Shr)&t<S<int>>>>=p; // expected-error {{use '> >'}}
303+
#endif
290304

291305
// FIXME: We correct this to '&t<int> > >= p;' not '&t<int> >>= p;'
292306
//(Shr)&t<int>>>=p;

test/Parser/backtrack-off-by-one.cpp

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
// RUN: %clang_cc1 -verify %s
2+
// RUN: %clang_cc1 -verify %s -std=c++98
3+
// RUN: %clang_cc1 -verify %s -std=c++11
24

35
// PR25946
46
// 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 {};
1012

1113
// expected-error@+1 {{expected '{' after base class list}}
1214
template <typename T> class B : T // not ',' or '{'
13-
// expected-error@+3 {{C++ requires a type specifier for all declarations}}
14-
// expected-error@+2 {{expected ';' after top level declarator}}
15+
#if __cplusplus < 201103L
16+
// expected-error@+4 {{expected ';' after top level declarator}}
17+
#endif
18+
// expected-error@+2 {{C++ requires a type specifier for all declarations}}
1519
// expected-error@+1 {{expected ';' after class}}
1620
A<int> {
1721
};

test/SemaCXX/copy-assignment.cpp

+14-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
// RUN: %clang_cc1 -fsyntax-only -verify %s
1+
// RUN: %clang_cc1 -fsyntax-only -verify %s
2+
// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++98
3+
// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11
4+
5+
#if __cplusplus >= 201103L
6+
// expected-note@+3 2 {{candidate constructor}}
7+
// expected-note@+2 {{passing argument to parameter here}}
8+
#endif
29
struct A {
310
};
411

@@ -7,6 +14,9 @@ struct ConvertibleToA {
714
};
815

916
struct ConvertibleToConstA {
17+
#if __cplusplus >= 201103L
18+
// expected-note@+2 {{candidate function}}
19+
#endif
1020
operator const A();
1121
};
1222

@@ -69,6 +79,9 @@ void test() {
6979
na = a;
7080
na = constA;
7181
na = convertibleToA;
82+
#if __cplusplus >= 201103L
83+
// expected-error@+2 {{no viable conversion}}
84+
#endif
7285
na = convertibleToConstA;
7386
na += a; // expected-error{{no viable overloaded '+='}}
7487

0 commit comments

Comments
 (0)