summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2013-06-07 02:33:37 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2013-06-07 02:33:37 +0000
commitcafeb948e6067b8dc897c441da522367917b06f9 (patch)
treec967fb05c754933e6a36ad7949cbc69fc9d29f14 /test
parent8150da3796300bdc876775e1782331f0e43d2d94 (diff)
downloadclang-cafeb948e6067b8dc897c441da522367917b06f9.tar.gz
PR16243: Use CXXThisOverride during template instantiation, and fix up the
places which weren't setting it up properly. This allows us to get the right cv-qualifiers for 'this' when it appears outside a method body in a class template. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183483 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/CXX/expr/expr.prim/expr.prim.general/p3-0x.cpp32
1 files changed, 30 insertions, 2 deletions
diff --git a/test/CXX/expr/expr.prim/expr.prim.general/p3-0x.cpp b/test/CXX/expr/expr.prim/expr.prim.general/p3-0x.cpp
index 66579915c7..fd90482ae8 100644
--- a/test/CXX/expr/expr.prim/expr.prim.general/p3-0x.cpp
+++ b/test/CXX/expr/expr.prim/expr.prim.general/p3-0x.cpp
@@ -30,16 +30,44 @@ struct C {
float &f(T*) const noexcept;
T* ptr;
- auto g1() noexcept(noexcept(f(ptr))) -> decltype(f((*this).ptr));
+ auto g1() noexcept(noexcept(f(ptr))) -> decltype(f(ptr));
auto g2() const noexcept(noexcept(f(((this))->ptr))) -> decltype(f(ptr));
+ auto g3() noexcept(noexcept(f(this->ptr))) -> decltype(f((*this).ptr));
+ auto g4() const noexcept(noexcept(f(((this))->ptr))) -> decltype(f(this->ptr));
+ auto g5() noexcept(noexcept(this->f(ptr))) -> decltype(this->f(ptr));
+ auto g6() const noexcept(noexcept(this->f(((this))->ptr))) -> decltype(this->f(ptr));
+ auto g7() noexcept(noexcept(this->f(this->ptr))) -> decltype(this->f((*this).ptr));
+ auto g8() const noexcept(noexcept(this->f(((this))->ptr))) -> decltype(this->f(this->ptr));
};
void test_C(C<int> ci) {
- int *p = 0;
int &ir = ci.g1();
float &fr = ci.g2();
+ int &ir2 = ci.g3();
+ float &fr2 = ci.g4();
+ int &ir3 = ci.g5();
+ float &fr3 = ci.g6();
+ int &ir4 = ci.g7();
+ float &fr4 = ci.g8();
static_assert(!noexcept(ci.g1()), "exception-specification failure");
static_assert(noexcept(ci.g2()), "exception-specification failure");
+ static_assert(!noexcept(ci.g3()), "exception-specification failure");
+ static_assert(noexcept(ci.g4()), "exception-specification failure");
+ static_assert(!noexcept(ci.g5()), "exception-specification failure");
+ static_assert(noexcept(ci.g6()), "exception-specification failure");
+ static_assert(!noexcept(ci.g7()), "exception-specification failure");
+ static_assert(noexcept(ci.g8()), "exception-specification failure");
+}
+
+namespace PR14263 {
+ template<typename T> struct X {
+ void f();
+ T f() const;
+
+ auto g() -> decltype(this->f()) { return f(); }
+ auto g() const -> decltype(this->f()) { return f(); }
+ };
+ template struct X<int>;
}
namespace PR10036 {