diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2016-11-25 19:07:40 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2016-11-25 19:07:40 +0000 |
| commit | 17c7957f023f02fc2c88f51f8908c19b52609275 (patch) | |
| tree | c654618ff2d38e26916b49614d89fe01f4a4818d /test/SemaCXX | |
| parent | c477790a57f44875b9de2043f2eb47dff2d20133 (diff) | |
Notes
Diffstat (limited to 'test/SemaCXX')
| -rw-r--r-- | test/SemaCXX/cxx0x-defaulted-functions.cpp | 35 | ||||
| -rw-r--r-- | test/SemaCXX/nested-name-spec.cpp | 18 |
2 files changed, 53 insertions, 0 deletions
diff --git a/test/SemaCXX/cxx0x-defaulted-functions.cpp b/test/SemaCXX/cxx0x-defaulted-functions.cpp index 16e20ff4964d..7ec9726095cb 100644 --- a/test/SemaCXX/cxx0x-defaulted-functions.cpp +++ b/test/SemaCXX/cxx0x-defaulted-functions.cpp @@ -208,3 +208,38 @@ int fn() { t = true; } } + +namespace dependent_classes { +template <bool B, typename X, typename Y> +struct conditional; + +template <typename X, typename Y> +struct conditional<true, X, Y> { typedef X type; }; + +template <typename X, typename Y> +struct conditional<false, X, Y> { typedef Y type; }; + +template<bool B> struct X { + X(); + + // B == false triggers error for = default. + using T = typename conditional<B, const X &, int>::type; + X(T) = default; // expected-error {{only special member functions}} + + // Either value of B creates a constructor that can be default + using U = typename conditional<B, X&&, const X&>::type; + X(U) = default; +}; + +X<true> x1; +X<false> x2; // expected-note {{in instantiation}} + +template <typename Type> +class E { + explicit E(const int &) = default; +}; + +template <typename Type> +E<Type>::E(const int&) {} // expected-error {{definition of explicitly defaulted function}} + +} diff --git a/test/SemaCXX/nested-name-spec.cpp b/test/SemaCXX/nested-name-spec.cpp index 0fbdedc70a69..f445725c7429 100644 --- a/test/SemaCXX/nested-name-spec.cpp +++ b/test/SemaCXX/nested-name-spec.cpp @@ -435,3 +435,21 @@ namespace PR16951 { // expected-error{{no member named 'X2' in 'PR16951::enumerator_2'}} } + +namespace PR30619 { +c d; c d; c d; c d; c d; c d; c d; c d; c d; c d; c d; c d; c d; c d; c d; c d; +// expected-error@-1 16{{unknown type name 'c'}} +c d; c d; c d; c d; c d; c d; c d; c d; c d; c d; c d; c d; c d; c d; c d; c d; +// expected-error@-1 16{{unknown type name 'c'}} +c d; c d; c d; c d; c d; c d; c d; c d; c d; c d; c d; c d; c d; c d; c d; c d; +// expected-error@-1 16{{unknown type name 'c'}} +c d; c d; c d; c d; c d; c d; c d; c d; c d; c d; c d; c d; c d; c d; c d; c d; +// expected-error@-1 16{{unknown type name 'c'}} +namespace A { +class B { + typedef C D; // expected-error{{unknown type name 'C'}} + A::D::F; + // expected-error@-1{{'D' (aka 'int') is not a class, namespace, or enumeration}} +}; +} +} |
