llvm-project/clang
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
..
INPUTS
bindings bindings: expose diagnostic formatting to Python 2016-08-11 05:31:07 +00:00
cmake [CMake] Adding toolchain targets to PGO and Apple CMake caches 2016-08-17 21:51:38 +00:00
docs [Modules] Add 'freestanding' to the 'requires-declaration' feature-list. 2016-09-04 06:00:42 +00:00
examples Reapply r276973 "Adjust Registry interface to not require plugins to export a registry" 2016-08-05 11:01:08 +00:00
include Add missing include. White space. 2016-09-07 17:30:50 +00:00
lib Try contextually converting condition of constexpr if to Boolean value 2016-09-07 18:24:54 +00:00
runtime [CMake] Properly connecting Compiler-RT check and test-depends 2016-09-01 18:28:49 +00:00
test Try contextually converting condition of constexpr if to Boolean value 2016-09-07 18:24:54 +00:00
tools [clang-offload-bundler] Fix some Clang-tidy modernize-use-override and Include What You Use warnings; other minor fixes. 2016-09-07 17:37:28 +00:00
unittests clang-format: [JS] whitespace required between ! and as. 2016-09-06 18:55:34 +00:00
utils Add plumbing for new attribute type "Microsoft". 2016-09-03 02:55:10 +00:00
www DR259: Demote the pedantic error for an explicit instantiation after an 2016-08-31 23:23:25 +00:00
.arcconfig
.clang-format
.clang-tidy
.gitignore
CMakeLists.txt driver: Support checking for rlimits via cmake (when bootstrapping) 2016-08-23 20:07:07 +00:00
CODE_OWNERS.TXT
INSTALL.txt
LICENSE.TXT
ModuleInfo.txt
NOTES.txt
README.txt

README.txt

//===----------------------------------------------------------------------===//
// C Language Family Front-end
//===----------------------------------------------------------------------===//

Welcome to Clang.  This is a compiler front-end for the C family of languages
(C, C++, Objective-C, and Objective-C++) which is built as part of the LLVM
compiler infrastructure project.

Unlike many other compiler frontends, Clang is useful for a number of things
beyond just compiling code: we intend for Clang to be host to a number of
different source-level tools.  One example of this is the Clang Static Analyzer.

If you're interested in more (including how to build Clang) it is best to read
the relevant web sites.  Here are some pointers:

Information on Clang:              http://clang.llvm.org/
Building and using Clang:          http://clang.llvm.org/get_started.html
Clang Static Analyzer:             http://clang-analyzer.llvm.org/
Information on the LLVM project:   http://llvm.org/

If you have questions or comments about Clang, a great place to discuss them is
on the Clang development mailing list:
  http://lists.llvm.org/mailman/listinfo/cfe-dev

If you find a bug in Clang, please file it in the LLVM bug tracker:
  http://llvm.org/bugs/