diff options
| author | Richard Trieu <rtrieu@google.com> | 2015-05-16 01:27:03 +0000 |
|---|---|---|
| committer | Richard Trieu <rtrieu@google.com> | 2015-05-16 01:27:03 +0000 |
| commit | f956a49e6da306c9ec3ac805822035043626481c (patch) | |
| tree | add6aaebf96b5a5347c6b45c2a4f599b07ec4041 /clang/test/SemaCXX | |
| parent | bb642e54564a605c71f4ee9a57e9ed430ac8f68f (diff) | |
| download | bcm5719-llvm-f956a49e6da306c9ec3ac805822035043626481c.tar.gz bcm5719-llvm-f956a49e6da306c9ec3ac805822035043626481c.zip | |
When emitting a dropped qualifier error, show which qualifiers are dropped.
llvm-svn: 237505
Diffstat (limited to 'clang/test/SemaCXX')
| -rw-r--r-- | clang/test/SemaCXX/builtins-arm.cpp | 2 | ||||
| -rw-r--r-- | clang/test/SemaCXX/err_reference_bind_drops_quals.cpp | 43 | ||||
| -rw-r--r-- | clang/test/SemaCXX/increment-decrement.cpp | 4 | ||||
| -rw-r--r-- | clang/test/SemaCXX/references.cpp | 2 |
4 files changed, 47 insertions, 4 deletions
diff --git a/clang/test/SemaCXX/builtins-arm.cpp b/clang/test/SemaCXX/builtins-arm.cpp index 683317dbbe6..81502794a94 100644 --- a/clang/test/SemaCXX/builtins-arm.cpp +++ b/clang/test/SemaCXX/builtins-arm.cpp @@ -2,5 +2,5 @@ // va_list on ARM AAPCS is struct { void* __ap }. int test1(const __builtin_va_list &ap) { - return __builtin_va_arg(ap, int); // expected-error {{binding value of type 'const __builtin_va_list' to reference of type '__builtin_va_list' drops qualifiers}} + return __builtin_va_arg(ap, int); // expected-error {{binding value of type 'const __builtin_va_list' to reference of type '__builtin_va_list' drops 'const' qualifier}} } diff --git a/clang/test/SemaCXX/err_reference_bind_drops_quals.cpp b/clang/test/SemaCXX/err_reference_bind_drops_quals.cpp new file mode 100644 index 00000000000..afdd8327f93 --- /dev/null +++ b/clang/test/SemaCXX/err_reference_bind_drops_quals.cpp @@ -0,0 +1,43 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +#define restrict __restrict__ +typedef int* ptr; +void test1(ptr p, const ptr cp, restrict ptr rp, const restrict ptr crp, + volatile ptr vp, const volatile ptr cvp, restrict volatile ptr rvp, + const restrict volatile ptr crvp) { + ptr& p1 = p; + ptr& p2 = cp; // expected-error {{drops 'const' qualifier}} + ptr& p3 = rp; // expected-error {{drops 'restrict' qualifier}} + ptr& p4 = crp; // expected-error {{drops 'const' and 'restrict' qualifiers}} + ptr& p5 = vp; // expected-error {{drops 'volatile' qualifier}} + ptr& p6 = cvp; // expected-error {{drops 'const' and 'volatile' qualifiers}} + ptr& p7 = rvp; // expected-error {{drops 'restrict' and 'volatile' qualifiers}} + ptr& p8 = crvp; // expected-error {{drops 'const', 'restrict', and 'volatile' qualifiers}} + + const ptr& cp1 = p; + const ptr& cp2 = cp; + const ptr& cp3 = rp; // expected-error {{drops 'restrict' qualifier}} + const ptr& cp4 = crp; // expected-error {{drops 'restrict' qualifier}} + const ptr& cp5 = vp; // expected-error {{drops 'volatile' qualifier}} + const ptr& cp6 = cvp; // expected-error {{drops 'volatile' qualifier}} + const ptr& cp7 = rvp; // expected-error {{drops 'restrict' and 'volatile' qualifiers}} + const ptr& cp8 = crvp; // expected-error {{drops 'restrict' and 'volatile' qualifiers}} + + const volatile ptr& cvp1 = p; + const volatile ptr& cvp2 = cp; + const volatile ptr& cvp3 = rp; // expected-error {{drops 'restrict' qualifier}} + const volatile ptr& cvp4 = crp; // expected-error {{drops 'restrict' qualifier}} + const volatile ptr& cvp5 = vp; + const volatile ptr& cvp6 = cvp; + const volatile ptr& cvp7 = rvp; // expected-error {{drops 'restrict' qualifier}} + const volatile ptr& cvp8 = crvp; // expected-error {{drops 'restrict' qualifier}} + + const restrict volatile ptr& crvp1 = p; + const restrict volatile ptr& crvp2 = cp; + const restrict volatile ptr& crvp3 = rp; + const restrict volatile ptr& crvp4 = crp; + const restrict volatile ptr& crvp5 = vp; + const restrict volatile ptr& crvp6 = cvp; + const restrict volatile ptr& crvp7 = rvp; + const restrict volatile ptr& crvp8 = crvp; +} diff --git a/clang/test/SemaCXX/increment-decrement.cpp b/clang/test/SemaCXX/increment-decrement.cpp index 11b7d1e12f4..4f131d76f04 100644 --- a/clang/test/SemaCXX/increment-decrement.cpp +++ b/clang/test/SemaCXX/increment-decrement.cpp @@ -5,8 +5,8 @@ volatile int i; const int &inc = i++; const int &dec = i--; -const int &incfail = ++i; // expected-error {{drops qualifiers}} -const int &decfail = --i; // expected-error {{drops qualifiers}} +const int &incfail = ++i; // expected-error {{drops 'volatile' qualifier}} +const int &decfail = --i; // expected-error {{drops 'volatile' qualifier}} // PR7794 void f0(int e) { diff --git a/clang/test/SemaCXX/references.cpp b/clang/test/SemaCXX/references.cpp index 64d87bd132b..aae4930593a 100644 --- a/clang/test/SemaCXX/references.cpp +++ b/clang/test/SemaCXX/references.cpp @@ -54,7 +54,7 @@ void test4() { void test5() { // const double& rcd2 = 2; // rcd2 refers to temporary with value 2.0 const volatile int cvi = 1; - const int& r = cvi; // expected-error{{binding value of type 'const volatile int' to reference of type 'const int' drops qualifiers}} + const int& r = cvi; // expected-error{{binding value of type 'const volatile int' to reference of type 'const int' drops 'volatile' qualifier}} } // C++ [dcl.init.ref]p3 |

