]> granicus.if.org Git - clang/commitdiff
Allow explicit ctors for casts.
authorAnders Carlsson <andersca@mac.com>
Fri, 28 Aug 2009 16:22:20 +0000 (16:22 +0000)
committerAnders Carlsson <andersca@mac.com>
Fri, 28 Aug 2009 16:22:20 +0000 (16:22 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80374 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaCXXCast.cpp
test/SemaCXX/cast-explicit-ctor.cpp [new file with mode: 0644]

index 9c27bf6e36ff13e49b8dacd3f287ef0cc9ef24f2..52ebdef6f11a61692cc83fff3b5ae94333488ee4 100644 (file)
@@ -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/test/SemaCXX/cast-explicit-ctor.cpp b/test/SemaCXX/cast-explicit-ctor.cpp
new file mode 100644 (file)
index 0000000..1064758
--- /dev/null
@@ -0,0 +1,6 @@
+// RUN: clang-cc -fsyntax-only -verify %s
+struct B { B(bool); };
+void f() { 
+  (void)(B)true;
+  (void)B(true); 
+}