From d186829093e8c9b2d96cb5b10c81a6e78519e33b Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Sun, 29 Apr 2018 05:33:38 +0000 Subject: Fix printing of reference-to-reference types. Previously we would sometimes print these as 'T &&&' or even 'T &&&&'. llvm-svn: 331137 --- clang/test/SemaCXX/references.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'clang/test/SemaCXX/references.cpp') 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 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(); // expected-note {{instantiation of}} + template void add_lref(); // expected-note {{instantiation of}} + template void add_lref(); // expected-note {{instantiation of}} + template void add_lref(); // expected-note {{instantiation of}} + + template 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(); // expected-note {{instantiation of}} + template void add_rref(); // expected-note {{instantiation of}} + template void add_rref(); // expected-note {{instantiation of}} + template void add_rref(); // expected-note {{instantiation of}} +} -- cgit v1.2.3