diff options
author | Vedant Kumar <vsk@apple.com> | 2019-12-18 14:52:51 -0800 |
---|---|---|
committer | Vedant Kumar <vsk@apple.com> | 2019-12-18 15:02:39 -0800 |
commit | 5094e6dad64c755be1bb797b0307c54dbae8871d (patch) | |
tree | e69dc554593934e48240b90458911b6098ae0862 /clang/test/CXX | |
parent | f0df4218b67d0abe96867804b8932b9b88998f51 (diff) | |
download | bcm5719-llvm-5094e6dad64c755be1bb797b0307c54dbae8871d.tar.gz bcm5719-llvm-5094e6dad64c755be1bb797b0307c54dbae8871d.zip |
Revert concepts changes from D41910
These changes caused LibcxxVariantDataFormatterTestCase in lldb to fail
with an assert:
Assertion failed: (Idx < size() && "Out-of-bounds Bit access."),
function operator[], file
/Users/buildslave/jenkins/workspace/lldb-cmake/llvm-project/llvm/include/llvm/ADT/SmallBitVector.h,
line 452.
In:
7 clang-10 0x00000001094b79d9 isAtLeastAsSpecializedAs(clang::Sema&, clang::SourceLocation, clang::FunctionTemplateDecl*, clang::FunctionTemplateDecl*, clang::TemplatePartialOrderingContext, unsigned int) + 1865
8 clang-10 0x00000001094b7111 clang::Sema::getMoreSpecializedTemplate(clang::FunctionTemplateDecl*, clang::FunctionTemplateDecl*, clang::SourceLocation, clang::TemplatePartialOrderingContext, unsigned int, unsigned int) + 97
9 clang-10 0x000000010939bf88 clang::isBetterOverloadCandidate(clang::Sema&, clang::OverloadCandidate const&, clang::OverloadCandidate const&, clang::SourceLocation, clang::OverloadCandidateSet::CandidateSetKind) + 1128
Revert "[Concepts] Fix incorrect move out of temporary in D41910"
This reverts commit 11d5fa6e87e3584f72056ecc2b17f88c58323dde.
Revert "[Concepts] Fix crash in D41910"
This reverts commit 12038be20ee6a903cdbd3fddce65535ef683e31d.
Revert "[Concepts] Constrained partial specializations and function overloads."
This reverts commit fc0731b98a67c793862288f8ae334322666214dc.
Diffstat (limited to 'clang/test/CXX')
5 files changed, 5 insertions, 213 deletions
diff --git a/clang/test/CXX/expr/expr.prim/expr.prim.id/p3.cpp b/clang/test/CXX/expr/expr.prim/expr.prim.id/p3.cpp index fb3978240af..1e10d4550ce 100644 --- a/clang/test/CXX/expr/expr.prim/expr.prim.id/p3.cpp +++ b/clang/test/CXX/expr/expr.prim/expr.prim.id/p3.cpp @@ -75,8 +75,11 @@ static_assert(!IsTypePredicate<T1>); template<typename T, typename U, typename... Ts> concept OneOf = (Same<T, Ts> || ...); -static_assert(OneOf<int, long, int>); -static_assert(!OneOf<long, int, char, char>); +template<typename... X> +constexpr bool S = OneOf<X..., int, int>; + +static_assert(S<int, long, int>); +static_assert(!S<long, int, char, char>); namespace piecewise_substitution { template <typename T> @@ -175,11 +178,3 @@ template<typename T> concept AccessPrivate = T{}.f; static_assert(AccessPrivate<T4>); // expected-error@-1{{static_assert failed}} // expected-note@-2{{because 'T4' does not satisfy 'AccessPrivate'}} - -template<typename T, typename U> -// expected-note@-1{{template parameter is declared here}} -concept C8 = sizeof(T) > sizeof(U); - -template<typename... T> -constexpr bool B8 = C8<T...>; -// expected-error@-1{{pack expansion used as argument for non-pack parameter of concept}} diff --git a/clang/test/CXX/temp/temp.constr/temp.constr.normal/p1.cpp b/clang/test/CXX/temp/temp.constr/temp.constr.normal/p1.cpp deleted file mode 100644 index 387b75c4ef0..00000000000 --- a/clang/test/CXX/temp/temp.constr/temp.constr.normal/p1.cpp +++ /dev/null @@ -1,18 +0,0 @@ -// RUN: %clang_cc1 -std=c++2a -fconcepts-ts -x c++ -verify %s - -template<typename T> concept True = true; -template<typename T> concept Foo = True<T*>; -template<typename T> concept Bar = Foo<T&>; -template<typename T> requires Bar<T> struct S { }; -template<typename T> requires Bar<T> && true struct S<T> { }; - -template<typename T> concept True2 = sizeof(T) >= 0; -template<typename T> concept Foo2 = True2<T*>; -// expected-error@-1{{'type name' declared as a pointer to a reference of type 'type-parameter-0-0 &'}} -template<typename T> concept Bar2 = Foo2<T&>; -// expected-note@-1{{while substituting into concept arguments here; substitution failures not allowed in concept arguments}} -template<typename T> requires Bar2<T> struct S2 { }; -// expected-note@-1{{template is declared here}} -template<typename T> requires Bar2<T> && true struct S2<T> { }; -// expected-error@-1{{class template partial specialization is not more specialized than the primary template}} -// expected-note@-2{{while calculating associated constraint of template 'S2' here}} diff --git a/clang/test/CXX/temp/temp.constr/temp.constr.order/class-template-partial-specializations.cpp b/clang/test/CXX/temp/temp.constr/temp.constr.order/class-template-partial-specializations.cpp deleted file mode 100644 index 8c2f5526941..00000000000 --- a/clang/test/CXX/temp/temp.constr/temp.constr.order/class-template-partial-specializations.cpp +++ /dev/null @@ -1,50 +0,0 @@ -// RUN: %clang_cc1 -std=c++2a -fconcepts-ts -x c++ -verify %s - -template<typename T> requires sizeof(T) >= 4 -class A{}; // expected-note{{template is declared here}} - -template<typename T> requires sizeof(T) >= 4 && sizeof(T) <= 10 -class A<T>{}; // expected-error{{class template partial specialization is not more specialized than the primary template}} - -template<typename T> -concept C1 = sizeof(T) >= 4; - -template<typename T> requires C1<T> -class B{}; - -template<typename T> requires C1<T> && sizeof(T) <= 10 -class B<T>{}; - -template<typename T> -concept C2 = sizeof(T) > 1 && sizeof(T) <= 8; - -template<typename T> -class C{}; - -template<typename T> requires C1<T> -class C<T>{}; - -template<typename T> -class D{}; // expected-note{{previous definition is here}} - -template<typename T> -class D<T>{}; // expected-error{{class template partial specialization does not specialize any template argument; to define the primary template, remove the template argument list}} expected-error{{redefinition of 'D'}} - -template<typename T> requires C1<T> // expected-note{{previous template declaration is here}} -class E{}; - -template<typename T> // expected-error{{requires clause differs in template redeclaration}} -class E<T>{}; // expected-error{{class template partial specialization does not specialize any template argument; to define the primary template, remove the template argument list}} - -template<typename T> -struct F{ enum{ value = 1 }; }; - -template<typename T> requires C1<T> && C2<T> -struct F<T>{ enum{ value = 2 }; }; - -template<typename T> requires C1<T> || C2<T> -struct F<T>{ enum{ value = 3 }; }; - -static_assert(F<unsigned>::value == 2); -static_assert(F<char[10]>::value == 3); -static_assert(F<char>::value == 1); diff --git a/clang/test/CXX/temp/temp.constr/temp.constr.order/function-templates.cpp b/clang/test/CXX/temp/temp.constr/temp.constr.order/function-templates.cpp deleted file mode 100644 index d1b52182df4..00000000000 --- a/clang/test/CXX/temp/temp.constr/temp.constr.order/function-templates.cpp +++ /dev/null @@ -1,82 +0,0 @@ -// RUN: %clang_cc1 -std=c++2a -fconcepts-ts -x c++ -verify %s - -template<typename T> requires sizeof(T) >= 4 -bool a() { return false; } // expected-note {{candidate function [with T = unsigned int]}} - -template<typename T> requires sizeof(T) >= 4 && sizeof(T) <= 10 -bool a() { return true; } // expected-note {{candidate function [with T = unsigned int]}} - -bool av = a<unsigned>(); // expected-error {{call to 'a' is ambiguous}} - -template<typename T> -concept C1 = sizeof(T) >= 4; - -template<typename T> requires C1<T> -constexpr bool b() { return false; } - -template<typename T> requires C1<T> && sizeof(T) <= 10 -constexpr bool b() { return true; } - -static_assert(b<int>()); -static_assert(!b<int[10]>()); - -template<typename T> -concept C2 = sizeof(T) > 1 && sizeof(T) <= 8; - -template<typename T> -bool c() { return false; } - -template<typename T> requires C1<T> -bool c() { return true; } - -template<typename T> requires C1<T> -constexpr bool d() { return false; } - -template<typename T> -constexpr bool d() { return true; } - -static_assert(!d<int>()); - -template<typename T> -constexpr int e() { return 1; } - -template<typename T> requires C1<T> && C2<T> -constexpr int e() { return 2; } - -template<typename T> requires C1<T> || C2<T> -constexpr int e() { return 3; } - -static_assert(e<unsigned>() == 2); -static_assert(e<char[10]>() == 3); -static_assert(e<char>() == 1); - -template<class T, class U> -concept BiggerThan = sizeof(T) > sizeof(U); - -template<class T> -concept BiggerThanInt = BiggerThan<T, int>; - -template<class T, class U> requires BiggerThan<T, U> -void f() { } -// expected-note@-1 {{candidate function [with T = long long, U = int]}} - -template<class T, class U> requires BiggerThanInt<T> -void f() { } -// expected-note@-1 {{candidate function [with T = long long, U = int]}} - -static_assert(sizeof(f<long long, int>())); -// expected-error@-1 {{call to 'f' is ambiguous}} - -template<typename T> -concept C3 = true; - -template<typename T> -concept C4 = true && C3<T>; - -template<typename T> requires C3<void> -int g() { } - -template<typename T> requires C4<void> -int g() { } - -static_assert(sizeof(g<int>()));
\ No newline at end of file diff --git a/clang/test/CXX/temp/temp.constr/temp.constr.order/var-template-partial-specializations.cpp b/clang/test/CXX/temp/temp.constr/temp.constr.order/var-template-partial-specializations.cpp deleted file mode 100644 index b40c77e70a1..00000000000 --- a/clang/test/CXX/temp/temp.constr/temp.constr.order/var-template-partial-specializations.cpp +++ /dev/null @@ -1,53 +0,0 @@ -// RUN: %clang_cc1 -std=c++2a -fconcepts-ts -x c++ -verify %s - -template<typename T> requires sizeof(T) >= 4 -bool a = false; // expected-note{{template is declared here}} - -template<typename T> requires sizeof(T) >= 4 && sizeof(T) <= 10 -bool a<T> = true; // expected-error{{variable template partial specialization is not more specialized than the primary template}} - -template<typename T> -concept C1 = sizeof(T) >= 4; - -template<typename T> requires C1<T> -bool b = false; - -template<typename T> requires C1<T> && sizeof(T) <= 10 -bool b<T> = true; - -template<typename T> -concept C2 = sizeof(T) > 1 && sizeof(T) <= 8; - -template<typename T> -bool c = false; - -template<typename T> requires C1<T> -bool c<T> = true; - -template<typename T> -bool d = false; - -template<typename T> -bool d<T> = true; // expected-error{{variable template partial specialization does not specialize any template argument; to define the primary template, remove the template argument list}} - -template<typename T> requires C1<T> -bool e = false; - -template<typename T> -bool e<T> = true; // expected-error{{variable template partial specialization does not specialize any template argument; to define the primary template, remove the template argument list}} - -template<typename T> -constexpr int f = 1; - -template<typename T> requires C1<T> && C2<T> -constexpr int f<T> = 2; - -template<typename T> requires C1<T> || C2<T> -constexpr int f<T> = 3; - -static_assert(f<unsigned> == 2); -static_assert(f<char[10]> == 3); -static_assert(f<char> == 1); - - - |