llvm-project/clang/test
Ismail Pazarbasi 4a00774e59 Try contextually converting condition of constexpr if to Boolean value
Summary:
C++1z 6.4.1/p2:
 If the if statement is of the form if constexpr, the value of the
 condition shall be a contextually converted constant expression of type
 bool [...]
C++1z 5.20/p4:
 [...] A contextually converted constant expression of type bool is an
 expression, contextually converted to bool (Clause4), where the
 converted expression is a constant expression and the conversion
 sequence contains only the conversions above. [...]

Contextually converting result of an expression `e` to a Boolean value
requires `bool t(e)` to be well-formed.

An explicit conversion function is only considered as a user-defined
conversion for direct-initialization, which is essentially what
//contextually converted to bool// requires.

Also, fixes PR28470.

Reviewers: rsmith

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D24158

llvm-svn: 280838
2016-09-07 18:24:54 +00:00
..
ARCMT [test/objcmt] Add a follow-up test case for r275600. 2016-07-15 20:40:24 +00:00
ASTMerge When importing classes and structs with anonymous structs, it is critical that 2016-07-14 19:53:44 +00:00
Analysis [analyzer] ExprEngine: remove second call to PreStmt<CastExpr> 2016-09-01 13:55:38 +00:00
CXX Try contextually converting condition of constexpr if to Boolean value 2016-09-07 18:24:54 +00:00
CodeCompletion Implement filtering for code completion of identifiers. 2016-07-27 14:56:59 +00:00
CodeGen [AVX-512] Remove 128-bit and 256-bit masked floating point add/sub/mul/div builtins and replace with native operations. 2016-09-04 18:30:17 +00:00
CodeGenCUDA [CUDA] Raise an error if a wrong-side call is codegen'ed. 2016-08-15 23:00:49 +00:00
CodeGenCXX Try contextually converting condition of constexpr if to Boolean value 2016-09-07 18:24:54 +00:00
CodeGenObjC CodeGen: try harder to make the CFString structure RW 2016-07-29 19:15:51 +00:00
CodeGenObjCXX [CodeGen][ObjC] Fix infinite recursion in getObjCEncodingForTypeImpl. 2016-08-17 19:42:22 +00:00
CodeGenOpenCL [OpenCL] Fix pipe built-in functions return type. 2016-09-07 10:32:03 +00:00
Coverage
CoverageMapping [Coverage] Suppress creating a code region if the same area is covered by an expansion region. 2016-08-31 07:04:16 +00:00
Driver [EfficiencySanitizer] [MIPS64] Enables esan clang driver options for MIPS64 2016-09-07 12:23:15 +00:00
FixIt ObjC Class Property: diagnostics when accessing a class property using instance. 2016-06-28 23:01:49 +00:00
Format Make clang-format remove duplicate headers when sorting #includes. 2016-08-10 09:32:23 +00:00
Frontend [Frontend] Fix mcount inlining bug 2016-09-01 11:29:21 +00:00
Headers Add MS __nop intrinsic to intrin.h 2016-09-07 16:55:12 +00:00
Index [index] Fix crash with indexing designated init expressions inside templates. 2016-08-03 05:38:53 +00:00
Integration
Layout [MS ABI] Implement __declspec(empty_bases) and __declspec(layout_version) 2016-05-23 17:16:12 +00:00
Lexer Add -fmodules-ts flag to cc1 for the provisional C++ modules TS, and mark 2016-07-23 02:32:21 +00:00
Misc Attempt to pacify buildbots after r280217 2016-08-31 11:01:41 +00:00
Modules Modules: Fix an assertion in DeclContext::buildLookup. 2016-09-06 18:16:54 +00:00
OpenMP Revert "[OpenMP] Sema and parsing for 'teams distribute simd’ pragma" 2016-08-18 09:25:07 +00:00
PCH Lazily load the ContextDecl for a lambda's DefinitionData, to fix a 2016-08-25 00:34:00 +00:00
Parser Add a test Aaron asked for that I forgot to add before landing r280578. 2016-09-03 04:27:14 +00:00
Preprocessor Parsing MS pragma intrinsic 2016-09-07 16:38:32 +00:00
Profile [Profile] Enable profile merging with -fprofile-generat[=<dir>] 2016-07-22 22:25:01 +00:00
Rewriter
Sema [ms] Add support for parsing uuid as a Microsoft attribute. 2016-09-03 03:25:22 +00:00
SemaCUDA [CUDA] Fix "declared here" note on deferred wrong-side errors. 2016-08-16 00:48:21 +00:00
SemaCXX Fix clang's handling of the copy performed in the second phase of class 2016-09-07 02:14:33 +00:00
SemaObjC [SemaObjC] Do not RebuildObjCMessageExpr without valid method decl 2016-08-22 21:50:22 +00:00
SemaObjCXX Sema: support __declspec(dll*) on ObjC interfaces 2016-07-15 20:41:10 +00:00
SemaOpenCL [Sema] Relax overloading restrictions in C. 2016-09-02 22:59:57 +00:00
SemaTemplate [Sema] Don't diagnose an array type mismatch when the new or previous 2016-09-01 01:03:21 +00:00
TableGen
Tooling Back out the test case for r266973 for now. 2016-04-21 10:46:14 +00:00
Unit Replace hardcoded comment at 'lit.site.cfg.in' 2016-04-16 06:54:46 +00:00
VFS Don't diagnose non-modular includes when we are not compiling a module. 2016-08-26 17:16:46 +00:00
.clang-format
CMakeLists.txt Revert "[test] Add libLTO as a clang test dependency on Darwin" 2016-08-30 20:36:48 +00:00
TestRunner.sh
cxx-sections.data
lit.cfg C++ Modules TS: add frontend support for building pcm files from module 2016-08-26 00:14:38 +00:00
lit.site.cfg.in Replace hardcoded comment at 'lit.site.cfg.in' 2016-04-16 06:54:46 +00:00
make_test_dirs.pl