summaryrefslogtreecommitdiffstats
path: root/test/CXX
diff options
context:
space:
mode:
authorNicolas Lesser <blitzrakete@gmail.com>2019-05-04 00:09:00 +0000
committerNicolas Lesser <blitzrakete@gmail.com>2019-05-04 00:09:00 +0000
commit6de0b449c07ec7adbcb34e7c94c544ee37ef5963 (patch)
tree0e2112dbbe57b79622f5a7708add8fecc6a75b80 /test/CXX
parent6cc60c9164a96f1d73ccfd302303490e0d085b87 (diff)
[clang] adding explicit(bool) from c++2a
this patch adds support for the explicit bool specifier. Changes: - The parsing for the explicit(bool) specifier was added in ParseDecl.cpp. - The storage of the explicit specifier was changed. the explicit specifier was stored as a boolean value in the FunctionDeclBitfields and in the DeclSpec class. now it is stored as a PointerIntPair<Expr*, 2> with a flag and a potential expression in CXXConstructorDecl, CXXDeductionGuideDecl, CXXConversionDecl and in the DeclSpec class. - Following the AST change, Serialization, ASTMatchers, ASTComparator and ASTPrinter were adapted. - Template instantiation was adapted to instantiate the potential expressions of the explicit(bool) specifier When instantiating their associated declaration. - The Add*Candidate functions were adapted, they now take a Boolean indicating if the context allowing explicit constructor or conversion function and this boolean is used to remove invalid overloads that required template instantiation to be detected. - Test for Semantic and Serialization were added. This patch is not yet complete. I still need to check that interaction with CTAD and deduction guides is correct. and add more tests for AST operations. But I wanted first feedback. Perhaps this patch should be spited in smaller patches, but making each patch testable as a standalone may be tricky. Patch by Tyker Differential Revision: https://reviews.llvm.org/D60934 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@359949 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CXX')
-rw-r--r--test/CXX/temp/temp.deduct.guide/p1.cpp2
-rw-r--r--test/CXX/temp/temp.deduct.guide/p3.cpp8
2 files changed, 5 insertions, 5 deletions
diff --git a/test/CXX/temp/temp.deduct.guide/p1.cpp b/test/CXX/temp/temp.deduct.guide/p1.cpp
index 8bb9da8a97..86aa29dc34 100644
--- a/test/CXX/temp/temp.deduct.guide/p1.cpp
+++ b/test/CXX/temp/temp.deduct.guide/p1.cpp
@@ -71,7 +71,7 @@ extern A(int(&)[26]) -> A<int>;
#endif
mutable A(int(&)[27]) -> A<int>; // expected-error-re {{{{'mutable' cannot be applied to|illegal storage class on}} function}}
virtual A(int(&)[28]) -> A<int>; // expected-error {{'virtual' can only appear on non-static member functions}}
-const A(int(&)[28]) -> A<int>; // expected-error {{deduction guide cannot be declared 'const'}}
+const A(int(&)[31]) -> A<int>; // expected-error {{deduction guide cannot be declared 'const'}}
const volatile static constexpr inline A(int(&)[29]) -> A<int>; // expected-error {{deduction guide cannot be declared 'static inline constexpr const volatile'}}
diff --git a/test/CXX/temp/temp.deduct.guide/p3.cpp b/test/CXX/temp/temp.deduct.guide/p3.cpp
index 07d1be0593..ec39c0c5ac 100644
--- a/test/CXX/temp/temp.deduct.guide/p3.cpp
+++ b/test/CXX/temp/temp.deduct.guide/p3.cpp
@@ -3,14 +3,14 @@
// The same restrictions apply to the parameter-declaration-clause of a
// deduction guide as in a function declaration.
template<typename T> struct A {};
-A(void) -> A<int>; // ok
+A(void) -> A<int>; // expected-note {{previous}}
A(void, int) -> A<int>; // expected-error {{'void' must be the first and only parameter if specified}}
-// We interpret this as also extending to the validity of redeclarations. It's
-// a bit of a stretch (OK, a lot of a stretch) but it gives desirable answers.
-A() -> A<int>; // ok, redeclaration
+A() -> A<int>; // expected-error {{redeclaration of deduction guide}}
+// expected-note@-1 {{previous}}
A() -> A<int>; // expected-note {{previous}}
+// expected-error@-1 {{redeclaration of deduction guide}}
A() -> A<float>; // FIXME: "functions" is a poor term. expected-error {{functions that differ only in their return type cannot be overloaded}}
template<typename T> A(T) -> A<typename T::foo>;