diff options
Diffstat (limited to 'test/CXX')
-rw-r--r-- | test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p7-1y.cpp | 4 | ||||
-rw-r--r-- | test/CXX/drs/dr9xx.cpp | 29 |
2 files changed, 33 insertions, 0 deletions
diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p7-1y.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p7-1y.cpp index f7b3e8e7be63..c3dc1de3ed6f 100644 --- a/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p7-1y.cpp +++ b/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p7-1y.cpp @@ -11,6 +11,9 @@ namespace std { int i; int &&f(); +template <typename T> +void overloaded_fn(T); // expected-note {{possible target}} + using Int = int; using IntLRef = int&; using IntRRef = int&&; @@ -57,6 +60,7 @@ decltype(auto) ((((((v1)))))) = 0; // ok decltype(auto) v2[1] = { 0 }; // expected-error {{cannot form array of 'decltype(auto)'}} decltype(auto) &v3 = { 0 }; // expected-error {{cannot form reference to 'decltype(auto)'}} decltype(auto) *v4 = { 0 }; // expected-error {{cannot form pointer to 'decltype(auto)'}} +decltype(auto) v5 = &overloaded_fn; // expected-error {{could not be resolved}} auto multi1a = 0, &multi1b = multi1a; auto multi1c = multi1a, multi1d = multi1b; diff --git a/test/CXX/drs/dr9xx.cpp b/test/CXX/drs/dr9xx.cpp index 4bcd6565e068..b37e17d6b098 100644 --- a/test/CXX/drs/dr9xx.cpp +++ b/test/CXX/drs/dr9xx.cpp @@ -44,3 +44,32 @@ namespace dr990 { // dr990: 3.5 D d{}; #endif } + +namespace dr948 { // dr948: 3.7 +#if __cplusplus >= 201103L + class A { + public: + constexpr A(int v) : v(v) { } + constexpr operator int() const { return v; } + private: + int v; + }; + + constexpr int id(int x) + { + return x; + } + + void f() { + if (constexpr int i = id(101)) { } + switch (constexpr int i = id(2)) { default: break; case 2: break; } + for (; constexpr int i = id(0); ) { } + while (constexpr int i = id(0)) { } + + if (constexpr A i = 101) { } + switch (constexpr A i = 2) { default: break; case 2: break; } + for (; constexpr A i = 0; ) { } + while (constexpr A i = 0) { } + } +#endif +} |