From f2bc7c386e78a5cb09d6bbc842de24d5701284fd Mon Sep 17 00:00:00 2001 From: Anders Carlsson Date: Fri, 28 Aug 2009 16:22:20 +0000 Subject: [PATCH] Allow explicit ctors for casts. llvm-svn: 80374 --- clang/lib/Sema/SemaCXXCast.cpp | 2 +- clang/test/SemaCXX/cast-explicit-ctor.cpp | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 clang/test/SemaCXX/cast-explicit-ctor.cpp diff --git a/clang/lib/Sema/SemaCXXCast.cpp b/clang/lib/Sema/SemaCXXCast.cpp index 9c27bf6e36ff..52ebdef6f11a 100644 --- a/clang/lib/Sema/SemaCXXCast.cpp +++ b/clang/lib/Sema/SemaCXXCast.cpp @@ -784,7 +784,7 @@ TryStaticImplicitCast(Sema &Self, Expr *SrcExpr, QualType DestType, ImplicitConversionSequence ICS = Self.TryImplicitConversion(SrcExpr, DestType, /*SuppressUserConversions=*/false, - /*AllowExplicit=*/false, + /*AllowExplicit=*/true, /*ForceRValue=*/false, /*InOverloadResolution=*/false); diff --git a/clang/test/SemaCXX/cast-explicit-ctor.cpp b/clang/test/SemaCXX/cast-explicit-ctor.cpp new file mode 100644 index 000000000000..1064758635d1 --- /dev/null +++ b/clang/test/SemaCXX/cast-explicit-ctor.cpp @@ -0,0 +1,6 @@ +// RUN: clang-cc -fsyntax-only -verify %s +struct B { B(bool); }; +void f() { + (void)(B)true; + (void)B(true); +}