diff options
author | Hubert Tong <hubert.reinterpretcast@gmail.com> | 2015-06-30 12:14:52 +0000 |
---|---|---|
committer | Hubert Tong <hubert.reinterpretcast@gmail.com> | 2015-06-30 12:14:52 +0000 |
commit | 375f00ad7bfb778005a82ef241f76bfe750d7582 (patch) | |
tree | 3adec1f7e5601d1339e6b3e9dc0bdacbba6a0fc9 /clang/test/Parser/cxx-concept-declaration.cpp | |
parent | a87af7a32645e606b961e013d81f9152d059196f (diff) | |
download | bcm5719-llvm-375f00ad7bfb778005a82ef241f76bfe750d7582.tar.gz bcm5719-llvm-375f00ad7bfb778005a82ef241f76bfe750d7582.zip |
[CONCEPTS] Parsing of concept keyword
Summary: This change adds parsing for the concept keyword in a
declaration and tracks the location. Diagnostic testing added for
invalid use of concept keyword.
Reviewers: faisalv, fraggamuffin, rsmith, hubert.reinterpretcast
Reviewed By: rsmith, hubert.reinterpretcast
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D10528
Patch by Nathan Wilson!
llvm-svn: 241060
Diffstat (limited to 'clang/test/Parser/cxx-concept-declaration.cpp')
-rw-r--r-- | clang/test/Parser/cxx-concept-declaration.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/clang/test/Parser/cxx-concept-declaration.cpp b/clang/test/Parser/cxx-concept-declaration.cpp new file mode 100644 index 00000000000..591629ca285 --- /dev/null +++ b/clang/test/Parser/cxx-concept-declaration.cpp @@ -0,0 +1,30 @@ + +// Support parsing of function concepts and variable concepts + +// RUN: %clang_cc1 -std=c++14 -fconcepts-ts -x c++ -verify %s + +template<typename T> concept bool C1 = true; + +template<typename T> concept bool C2() { return true; } + +template<typename T> +struct A { typedef bool Boolean; }; + +template<int N> +A<void>::Boolean concept C3(!0); + +template<typename T, int = 0> +concept auto C4(void) -> bool { return true; } + +constexpr int One = 1; + +template <typename> +static concept decltype(!0) C5 { bool(One) }; + +template<typename T> concept concept bool C6 = true; // expected-warning {{duplicate 'concept' declaration specifier}} + +template<typename T> concept concept bool C7() { return true; } // expected-warning {{duplicate 'concept' declaration specifier}} + +concept D1 = true; // expected-error {{C++ requires a type specifier for all declarations}} + +template<concept T> concept bool D2 = true; // expected-error {{unknown type name 'T'}} |