diff options
| author | Nico Weber <nicolasweber@gmx.de> | 2019-10-15 14:46:39 +0000 |
|---|---|---|
| committer | Nico Weber <nicolasweber@gmx.de> | 2019-10-15 14:46:39 +0000 |
| commit | b4638f9ff063a29e84b2d6b949ee4f7d27e4c2ab (patch) | |
| tree | 79427a0c40b6ecd133a1f6dee91e1276f0629d02 /clang/test/CXX/concepts-ts/dcl.dcl | |
| parent | 52d2a567b5ea4f2ec6d1dd5e9b5661ca8b763eae (diff) | |
| download | bcm5719-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/CXX/concepts-ts/dcl.dcl')
6 files changed, 168 insertions, 0 deletions
diff --git a/clang/test/CXX/concepts-ts/dcl.dcl/dcl.spec/dcl.spec.concept/p1.cpp b/clang/test/CXX/concepts-ts/dcl.dcl/dcl.spec/dcl.spec.concept/p1.cpp new file mode 100644 index 00000000000..863b608b5b7 --- /dev/null +++ b/clang/test/CXX/concepts-ts/dcl.dcl/dcl.spec/dcl.spec.concept/p1.cpp @@ -0,0 +1,61 @@ +// RUN: %clang_cc1 -std=c++14 -fconcepts-ts -fcxx-exceptions -x c++ -verify %s + +namespace A { + template<typename T> concept bool C1() { return true; } + + template<typename T> concept bool C2 = true; +} + +template<typename T> concept bool C3() { return (throw 0, true); } +static_assert(noexcept(C3<int>()), "function concept should be treated as if noexcept(true) specified"); + +template<typename T> concept bool D1(); // expected-error {{function concept declaration must be a definition}} + +struct B { + template<typename T> concept bool D2() { return true; } // expected-error {{concept declarations may only appear in namespace scope}} +}; + +struct C { + template<typename T> static concept bool D3 = true; // expected-error {{concept declarations may only appear in namespace scope}} +}; + +concept bool D4() { return true; } // expected-error {{'concept' can only appear on the definition of a function template or variable template}} + +concept bool D5 = true; // expected-error {{'concept' can only appear on the definition of a function template or variable template}} + +template<typename T> +concept bool D6; // expected-error {{variable concept declaration must be initialized}} + +template<typename T> +concept bool D7() throw(int) { return true; } // expected-error {{function concept cannot have exception specification}} + +// Tag + +concept class CC1 {}; // expected-error {{'concept' can only appear on the definition of a function template or variable template}} +concept struct CS1 {}; // expected-error {{'concept' can only appear on the definition of a function template or variable template}} +concept union CU1 {}; // expected-error {{'concept' can only appear on the definition of a function template or variable template}} +concept enum CE1 {}; // expected-error {{'concept' can only appear on the definition of a function template or variable template}} +template <typename T> concept class TCC1 {}; // expected-error {{'concept' can only appear on the definition of a function template or variable template}} +template <typename T> concept struct TCS1 {}; // expected-error {{'concept' can only appear on the definition of a function template or variable template}} +template <typename T> concept union TCU1 {}; // expected-error {{'concept' can only appear on the definition of a function template or variable template}} +typedef concept int CI; // expected-error {{'concept' can only appear on the definition of a function template or variable template}} +void fpc(concept int i) {} // expected-error {{'concept' can only appear on the definition of a function template or variable template}} + +concept bool; // expected-error {{'concept' can only appear on the definition of a function template or variable template}} + +template <typename T> concept bool VCEI{ true }; +template concept bool VCEI<int>; // expected-error {{'concept' cannot be applied on an explicit instantiation}} +extern template concept bool VCEI<int>; // expected-error {{'concept' cannot be applied on an explicit instantiation}} + +template <typename T> concept bool VCPS{ true }; +template <typename T> concept bool VCPS<T *>{ true }; // expected-error {{'concept' cannot be applied on an partial specialization}} + +template <typename T> concept bool VCES{ true }; +template <> concept bool VCES<int>{ true }; // expected-error {{'concept' cannot be applied on an explicit specialization}} + +template <typename T> concept bool FCEI() { return true; } +template concept bool FCEI<int>(); // expected-error {{'concept' cannot be applied on an explicit instantiation}} +extern template concept bool FCEI<int>(); // expected-error {{'concept' cannot be applied on an explicit instantiation}} + +template <typename T> concept bool FCES() { return true; } +template <> concept bool FCES<bool>() { return true; } // expected-error {{'concept' cannot be applied on an explicit specialization}} diff --git a/clang/test/CXX/concepts-ts/dcl.dcl/dcl.spec/dcl.spec.concept/p2.cpp b/clang/test/CXX/concepts-ts/dcl.dcl/dcl.spec/dcl.spec.concept/p2.cpp new file mode 100644 index 00000000000..477910986de --- /dev/null +++ b/clang/test/CXX/concepts-ts/dcl.dcl/dcl.spec/dcl.spec.concept/p2.cpp @@ -0,0 +1,13 @@ +// RUN: %clang_cc1 -std=c++14 -fconcepts-ts -x c++ -verify %s + +template<typename T> concept thread_local bool VCTL = true; // expected-error {{variable concept cannot be declared 'thread_local'}} + +template<typename T> concept constexpr bool VCC = true; // expected-error {{variable concept cannot be declared 'constexpr'}} + +template<typename T> concept inline bool FCI() { return true; } // expected-error {{function concept cannot be declared 'inline'}} + +struct X { + template<typename T> concept friend bool FCF() { return true; } // expected-error {{function concept cannot be declared 'friend'}} +}; + +template<typename T> concept constexpr bool FCC() { return true; } // expected-error {{function concept cannot be declared 'constexpr'}} diff --git a/clang/test/CXX/concepts-ts/dcl.dcl/dcl.spec/dcl.spec.concept/p5.cpp b/clang/test/CXX/concepts-ts/dcl.dcl/dcl.spec/dcl.spec.concept/p5.cpp new file mode 100644 index 00000000000..69672ca8306 --- /dev/null +++ b/clang/test/CXX/concepts-ts/dcl.dcl/dcl.spec/dcl.spec.concept/p5.cpp @@ -0,0 +1,25 @@ +// RUN: %clang_cc1 -std=c++14 -fconcepts-ts -x c++ -verify %s + +template<typename T> +concept bool fcpv(void) { return true; } + +template<typename T> +concept bool fcpi(int i = 0) { return true; } // expected-error {{function concept cannot have any parameters}} + +template<typename... Ts> +concept bool fcpp(Ts... ts) { return true; } // expected-error {{function concept cannot have any parameters}} + +template<typename T> +concept bool fcpva(...) { return true; } // expected-error {{function concept cannot have any parameters}} + +template<typename T> +concept const bool fcrtc() { return true; } // expected-error {{declared return type of function concept must be 'bool'}} + +template<typename T> +concept int fcrti() { return 5; } // expected-error {{declared return type of function concept must be 'bool'}} + +template<typename T> +concept float fcrtf() { return 5.5; } // expected-error {{declared return type of function concept must be 'bool'}} + +template<typename T> +concept decltype(auto) fcrtd(void) { return true; } // expected-error {{declared return type of function concept must be 'bool'}} diff --git a/clang/test/CXX/concepts-ts/dcl.dcl/dcl.spec/dcl.spec.concept/p6.cpp b/clang/test/CXX/concepts-ts/dcl.dcl/dcl.spec/dcl.spec.concept/p6.cpp new file mode 100644 index 00000000000..f8a1bb72e39 --- /dev/null +++ b/clang/test/CXX/concepts-ts/dcl.dcl/dcl.spec/dcl.spec.concept/p6.cpp @@ -0,0 +1,25 @@ +// RUN: %clang_cc1 -std=c++14 -fconcepts-ts -x c++ -verify %s + +template<typename T> +concept bool vc { true }; + +template<typename T> +struct B { typedef bool Boolean; }; + +template<int N> +B<void>::Boolean concept vctb(!0); + +template<typename T> +concept const bool vctc { true }; // expected-error {{declared type of variable concept must be 'bool'}} + +template<typename T> +concept int vcti { 5 }; // expected-error {{declared type of variable concept must be 'bool'}} + +template<typename T> +concept float vctf { 5.5 }; // expected-error {{declared type of variable concept must be 'bool'}} + +template<typename T> +concept auto vcta { true }; // expected-error {{declared type of variable concept must be 'bool'}} + +template<typename T> +concept decltype(auto) vctd { true }; // expected-error {{declared type of variable concept must be 'bool'}} diff --git a/clang/test/CXX/concepts-ts/dcl.dcl/dcl.spec/dcl.spec.concept/p7.cpp b/clang/test/CXX/concepts-ts/dcl.dcl/dcl.spec/dcl.spec.concept/p7.cpp new file mode 100644 index 00000000000..1bad6bb9329 --- /dev/null +++ b/clang/test/CXX/concepts-ts/dcl.dcl/dcl.spec/dcl.spec.concept/p7.cpp @@ -0,0 +1,18 @@ +// RUN: %clang_cc1 -std=c++14 -fconcepts-ts -x c++ -verify %s + +template <typename T> concept bool FCEI() { return true; } // expected-note {{previous declaration is here}} expected-note {{previous declaration is here}} +template bool FCEI<int>(); // expected-error {{function concept cannot be explicitly instantiated}} +extern template bool FCEI<double>(); // expected-error {{function concept cannot be explicitly instantiated}} + +template <typename T> concept bool FCES() { return true; } // expected-note {{previous declaration is here}} +template <> bool FCES<int>() { return true; } // expected-error {{function concept cannot be explicitly specialized}} + +template <typename T> concept bool VC { true }; // expected-note {{previous declaration is here}} expected-note {{previous declaration is here}} +template bool VC<int>; // expected-error {{variable concept cannot be explicitly instantiated}} +extern template bool VC<double>; // expected-error {{variable concept cannot be explicitly instantiated}} + +template <typename T> concept bool VCES { true }; // expected-note {{previous declaration is here}} +template <> bool VCES<int> { true }; // expected-error {{variable concept cannot be explicitly specialized}} + +template <typename T> concept bool VCPS { true }; // expected-note {{previous declaration is here}} +template <typename T> bool VCPS<T *> { true }; // expected-error {{variable concept cannot be partially specialized}} diff --git a/clang/test/CXX/concepts-ts/dcl.dcl/lit.cfg.py b/clang/test/CXX/concepts-ts/dcl.dcl/lit.cfg.py new file mode 100644 index 00000000000..c705e3cb93b --- /dev/null +++ b/clang/test/CXX/concepts-ts/dcl.dcl/lit.cfg.py @@ -0,0 +1,26 @@ +# -*- Python -*- + +import os +import lit.formats + +from lit.llvm import llvm_config + +# Configuration file for the 'lit' test runner. + +# name: The name of this test suite. +config.name = 'Clang-Concepts-TS-Unsupported' + +# testFormat: The test format to use to interpret tests. +# +# For now we require '&&' between commands, until they get globally killed and +# the test runner updated. +config.test_format = lit.formats.ShTest(not llvm_config.use_lit_shell) + +# suffixes: A list of file extensions to treat as test files. +config.suffixes = ['.c', '.cpp', '.cppm', '.m', '.mm', '.cu', + '.ll', '.cl', '.s', '.S', '.modulemap', '.test', '.rs'] + +config.unsupported = True + +# test_source_root: The root path where tests are located. +config.test_source_root = os.path.dirname(__file__) |

