diff options
author | David Blaikie <dblaikie@gmail.com> | 2013-05-15 07:37:26 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2013-05-15 07:37:26 +0000 |
commit | 7247c88d1e41514a41085f83ebf03dd5220e054a (patch) | |
tree | 7672e55dc561fa1fb210fc9b219d010995529f4a /include/clang/Sema/Sema.h | |
parent | fcec0c991edbb011a1eeb85d8de836502f799aed (diff) | |
download | clang-7247c88d1e41514a41085f83ebf03dd5220e054a.tar.gz clang-7247c88d1e41514a41085f83ebf03dd5220e054a.tar.bz2 clang-7247c88d1e41514a41085f83ebf03dd5220e054a.tar.xz |
Use only explicit bool conversion operator
The most common (non-buggy) case are where such objects are used as
return expressions in bool-returning functions or as boolean function
arguments. In those cases I've used (& added if necessary) a named
function to provide the equivalent (or sometimes negative, depending on
convenient wording) test.
DiagnosticBuilder kept its implicit conversion operator owing to the
prevalent use of it in return statements.
One bug was found in ExprConstant.cpp involving a comparison of two
PointerUnions (PointerUnion did not previously have an operator==, so
instead both operands were converted to bool & then compared). A test
is included in test/SemaCXX/constant-expression-cxx1y.cpp for the fix
(adding operator== to PointerUnion in LLVM).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181869 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Sema/Sema.h')
-rw-r--r-- | include/clang/Sema/Sema.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/clang/Sema/Sema.h b/include/clang/Sema/Sema.h index c2300e977e..61b91c5962 100644 --- a/include/clang/Sema/Sema.h +++ b/include/clang/Sema/Sema.h @@ -5994,7 +5994,7 @@ public: /// \brief Determines whether we have exceeded the maximum /// recursive template instantiations. - operator bool() const { return Invalid; } + LLVM_EXPLICIT operator bool() const { return Invalid; } private: Sema &SemaRef; |