summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/references.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2018-04-29 05:33:38 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2018-04-29 05:33:38 +0000
commitd186829093e8c9b2d96cb5b10c81a6e78519e33b (patch)
tree17b39126d6febc27dd0fc3bd5552990a9dd5df47 /clang/test/SemaCXX/references.cpp
parent4ae767ba3d4a501511708298a95d0c660a3ea212 (diff)
downloadbcm5719-llvm-d186829093e8c9b2d96cb5b10c81a6e78519e33b.tar.gz
bcm5719-llvm-d186829093e8c9b2d96cb5b10c81a6e78519e33b.zip
Fix printing of reference-to-reference types.
Previously we would sometimes print these as 'T &&&' or even 'T &&&&'. llvm-svn: 331137
Diffstat (limited to 'clang/test/SemaCXX/references.cpp')
-rw-r--r--clang/test/SemaCXX/references.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/references.cpp b/clang/test/SemaCXX/references.cpp
index dc59d503ba8..b34b740bd44 100644
--- a/clang/test/SemaCXX/references.cpp
+++ b/clang/test/SemaCXX/references.cpp
@@ -154,3 +154,31 @@ namespace ExplicitRefInit {
struct A { explicit A(int); };
const A &a(0); // expected-error {{reference to type 'const ExplicitRefInit::A' could not bind to an rvalue of type 'int'}}
}
+
+namespace RefCollapseTypePrinting {
+ template<typename T> void add_lref() {
+ using X = int(T); // expected-note 4{{previous}}
+ using X = const volatile T&;
+ // expected-error@-1 {{'int &' vs 'int (int &)'}}
+ // expected-error@-2 {{'int &' vs 'int (int &&)'}}
+ // expected-error@-3 {{'const int &' vs 'int (const int &)'}}
+ // expected-error@-4 {{'const int &' vs 'int (const int &&)'}}
+ }
+ template void add_lref<int&>(); // expected-note {{instantiation of}}
+ template void add_lref<int&&>(); // expected-note {{instantiation of}}
+ template void add_lref<const int&>(); // expected-note {{instantiation of}}
+ template void add_lref<const int&&>(); // expected-note {{instantiation of}}
+
+ template<typename T> void add_rref() {
+ using X = int(T); // expected-note 4{{previous}}
+ using X = const volatile T&&;
+ // expected-error@-1 {{'int &' vs 'int (int &)'}}
+ // expected-error@-2 {{'int &&' vs 'int (int &&)'}}
+ // expected-error@-3 {{'const int &' vs 'int (const int &)'}}
+ // expected-error@-4 {{'const int &&' vs 'int (const int &&)'}}
+ }
+ template void add_rref<int&>(); // expected-note {{instantiation of}}
+ template void add_rref<int&&>(); // expected-note {{instantiation of}}
+ template void add_rref<const int&>(); // expected-note {{instantiation of}}
+ template void add_rref<const int&&>(); // expected-note {{instantiation of}}
+}
OpenPOWER on IntegriCloud