summaryrefslogtreecommitdiffstats
path: root/clang/test/Parser
diff options
context:
space:
mode:
authorNico Weber <nicolasweber@gmx.de>2019-10-15 14:46:39 +0000
committerNico Weber <nicolasweber@gmx.de>2019-10-15 14:46:39 +0000
commitb4638f9ff063a29e84b2d6b949ee4f7d27e4c2ab (patch)
tree79427a0c40b6ecd133a1f6dee91e1276f0629d02 /clang/test/Parser
parent52d2a567b5ea4f2ec6d1dd5e9b5661ca8b763eae (diff)
downloadbcm5719-llvm-b4638f9ff063a29e84b2d6b949ee4f7d27e4c2ab.tar.gz
bcm5719-llvm-b4638f9ff063a29e84b2d6b949ee4f7d27e4c2ab.zip
Revert 374882 "[Concepts] Concept Specialization Expressions"
This reverts commit ec87b003823d63f3342cf648f55a134c1522e612. The test fails on Windows, see e.g. http://lab.llvm.org:8011/builders/clang-x64-windows-msvc/builds/11533/steps/stage%201%20check/logs/stdio Also revert follow-up r374893. llvm-svn: 374899
Diffstat (limited to 'clang/test/Parser')
-rw-r--r--clang/test/Parser/cxx2a-concept-declaration.cpp61
1 files changed, 17 insertions, 44 deletions
diff --git a/clang/test/Parser/cxx2a-concept-declaration.cpp b/clang/test/Parser/cxx2a-concept-declaration.cpp
index 4dcfa3f8543..d80b3db428c 100644
--- a/clang/test/Parser/cxx2a-concept-declaration.cpp
+++ b/clang/test/Parser/cxx2a-concept-declaration.cpp
@@ -14,6 +14,8 @@ template<template<typename> concept T> concept D2 = true;
// expected-error@-2{{template template parameter requires 'class' after the parameter list}}
// expected-error@-3{{concept template parameter list must have at least one parameter; explicit specialization of concepts is not allowed}}
+template<typename T> concept C2 = 0.f; // expected-error {{constraint expression must be of type 'bool' but is of type 'float'}}
+
struct S1 {
template<typename T> concept C1 = true; // expected-error {{concept declarations may only appear in global or namespace scope}}
};
@@ -24,15 +26,15 @@ extern "C++" {
template<typename A>
template<typename B>
-concept C2 = true; // expected-error {{extraneous template parameter list in concept definition}}
+concept C4 = true; // expected-error {{extraneous template parameter list in concept definition}}
-template<typename T> concept C3 = true; // expected-note {{previous}} expected-note {{previous}}
-int C3; // expected-error {{redefinition}}
-struct C3 {}; // expected-error {{redefinition}}
+template<typename T> concept C5 = true; // expected-note {{previous}} expected-note {{previous}}
+int C5; // expected-error {{redefinition}}
+struct C5 {}; // expected-error {{redefinition}}
-struct C4 {}; // expected-note{{previous definition is here}}
-template<typename T> concept C4 = true;
-// expected-error@-1{{redefinition of 'C4' as different kind of symbol}}
+struct C6 {}; // expected-note{{previous definition is here}}
+template<typename T> concept C6 = true;
+// expected-error@-1{{redefinition of 'C6' as different kind of symbol}}
// TODO: Add test to prevent explicit specialization, partial specialization
// and explicit instantiation of concepts.
@@ -41,60 +43,31 @@ template<typename T, T v>
struct integral_constant { static constexpr T value = v; };
namespace N {
- template<typename T> concept C5 = true;
+ template<typename T> concept C7 = true;
}
-using N::C5;
+using N::C7;
-template <bool word> concept C6 = integral_constant<bool, wor>::value;
+template <bool word> concept C8 = integral_constant<bool, wor>::value;
// expected-error@-1{{use of undeclared identifier 'wor'; did you mean 'word'?}}
// expected-note@-2{{'word' declared here}}
-template<typename T> concept bool C7 = true;
+template<typename T> concept bool C9 = true;
// expected-warning@-1{{ISO C++2a does not permit the 'bool' keyword after 'concept'}}
-template<> concept C8 = false;
+template<> concept C10 = false;
// expected-error@-1{{concept template parameter list must have at least one parameter; explicit specialization of concepts is not allowed}}
-template<> concept C7<int> = false;
+template<> concept C9<int> = false;
// expected-error@-1{{name defined in concept definition must be an identifier}}
-template<typename T> concept N::C9 = false;
+template<typename T> concept N::C11 = false;
// expected-error@-1{{name defined in concept definition must be an identifier}}
class A { };
// expected-note@-1{{'A' declared here}}
-template<typename T> concept A::C10 = false;
+template<typename T> concept A::C12 = false;
// expected-error@-1{{expected namespace name}}
template<typename T> concept operator int = false;
// expected-error@-1{{name defined in concept definition must be an identifier}}
-
-template<bool x> concept C11 = 2; // expected-error {{atomic constraint must be of type 'bool' (found 'int')}}
-template<bool x> concept C12 = 2 && x; // expected-error {{atomic constraint must be of type 'bool' (found 'int')}}
-template<bool x> concept C13 = x || 2 || x; // expected-error {{atomic constraint must be of type 'bool' (found 'int')}}
-template<bool x> concept C14 = 8ull && x || x; // expected-error {{atomic constraint must be of type 'bool' (found 'unsigned long long')}}
-template<typename T> concept C15 = sizeof(T); // expected-error {{atomic constraint must be of type 'bool' (found 'unsigned long')}}
-template<typename T> concept C16 = true && (0 && 0); // expected-error {{atomic constraint must be of type 'bool' (found 'int')}}
-// expected-warning@-1{{use of logical '&&' with constant operand}}
-// expected-note@-2{{use '&' for a bitwise operation}}
-// expected-note@-3{{remove constant to silence this warning}}
-template<typename T> concept C17 = T{};
-static_assert(!C17<bool>);
-template<typename T> concept C18 = (bool&&)true;
-static_assert(C18<int>);
-template<typename T> concept C19 = (const bool&)true;
-static_assert(C19<int>);
-template<typename T> concept C20 = (const bool)true;
-static_assert(C20<int>);
-template <bool c> concept C21 = integral_constant<bool, c>::value && true;
-static_assert(C21<true>);
-static_assert(!C21<false>);
-template <bool c> concept C22 = integral_constant<bool, c>::value;
-static_assert(C22<true>);
-static_assert(!C22<false>);
-
-template <bool word> concept C23 = integral_constant<bool, wor>::value;
-// expected-error@-1{{use of undeclared identifier 'wor'; did you mean 'word'?}}
-// expected-note@-2{{'word' declared here}}
-
OpenPOWER on IntegriCloud