diff options
Diffstat (limited to 'test/CXX/expr/expr.prim/expr.prim.general/p3-0x.cpp')
-rw-r--r-- | test/CXX/expr/expr.prim/expr.prim.general/p3-0x.cpp | 37 |
1 files changed, 37 insertions, 0 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 b84cec6..6657991 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 @@ -61,9 +61,26 @@ namespace PR10036 { } } +namespace PR15290 { + template<typename T> + class A { + T v_; + friend int add_to_v(A &t) noexcept(noexcept(v_ + 42)) + { + return t.v_ + 42; + } + }; + void f() + { + A<int> t; + add_to_v(t); + } +} + namespace Static { struct X1 { int m; + // FIXME: This should be accepted. static auto f() -> decltype(m); // expected-error{{'this' cannot be implicitly used in a static member function declaration}} static auto g() -> decltype(this->m); // expected-error{{'this' cannot be used in a static member function declaration}} @@ -99,3 +116,23 @@ namespace PR12564 { void foo(Derived& d) noexcept(noexcept(d.bar(d))) {} // expected-error {{cannot bind to a value of unrelated type}} }; } + +namespace rdar13473493 { + template <typename F> + class wrap + { + public: + template <typename... Args> + auto operator()(Args&&... args) const -> decltype(wrapped(args...)) // expected-note{{candidate template ignored: substitution failure [with Args = <int>]: use of undeclared identifier 'wrapped'}} + { + return wrapped(args...); + } + + private: + F wrapped; + }; + + void test(wrap<int (*)(int)> w) { + w(5); // expected-error{{no matching function for call to object of type 'wrap<int (*)(int)>'}} + } +} |