diff options
-rw-r--r-- | clang/lib/Sema/SemaCXXCast.cpp | 2 | ||||
-rw-r--r-- | clang/test/SemaCXX/cast-explicit-ctor.cpp | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaCXXCast.cpp b/clang/lib/Sema/SemaCXXCast.cpp index 9c27bf6e36f..52ebdef6f11 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 00000000000..1064758635d --- /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); +} |