From 6de0b449c07ec7adbcb34e7c94c544ee37ef5963 Mon Sep 17 00:00:00 2001 From: Nicolas Lesser Date: Sat, 4 May 2019 00:09:00 +0000 Subject: [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 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 --- test/SemaCXX/explicit.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'test/SemaCXX/explicit.cpp') diff --git a/test/SemaCXX/explicit.cpp b/test/SemaCXX/explicit.cpp index a3902e5d10..bd1199f23c 100644 --- a/test/SemaCXX/explicit.cpp +++ b/test/SemaCXX/explicit.cpp @@ -1,4 +1,6 @@ // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++2a %s + namespace Constructor { struct A { A(int); @@ -183,7 +185,8 @@ namespace Conversion { const int ©List7 = {b}; const int ©List8 = {n}; // expected-error {{no viable conversion}} } - + +#if __cplusplus < 201707L void testNew() { // 5.3.4p6: @@ -200,7 +203,8 @@ namespace Conversion { new int[i]; new int[ni]; // expected-error {{array size expression of type 'NotInt' requires explicit conversion to type 'int'}} } - +#endif + void testDelete() { // 5.3.5pp2: -- cgit v1.2.3