[cfe-commits] r155938 - in /cfe/trunk: lib/Sema/SemaExpr.cpp test/SemaCXX/conversion.cpp

David Blaikie dblaikie at gmail.com
Tue May 1 13:28:45 PDT 2012


Author: dblaikie
Date: Tue May  1 15:28:45 2012
New Revision: 155938

URL: http://llvm.org/viewvc/llvm-project?rev=155938&view=rev
Log:
Workaround a miscompile in 483.xalancbmk while we figure it out.

Modified:
    cfe/trunk/lib/Sema/SemaExpr.cpp
    cfe/trunk/test/SemaCXX/conversion.cpp

Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=155938&r1=155937&r2=155938&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Tue May  1 15:28:45 2012
@@ -3302,7 +3302,6 @@
 
     Expr *Arg = Result.takeAs<Expr>();
     CheckImplicitConversions(Arg, Arg->getExprLoc());
-    Param->setDefaultArg(Arg);
     // Build the default argument expression.
     return Owned(CXXDefaultArgExpr::Create(Context, CallLoc, Param, Arg));
   }

Modified: cfe/trunk/test/SemaCXX/conversion.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/conversion.cpp?rev=155938&r1=155937&r2=155938&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/conversion.cpp (original)
+++ cfe/trunk/test/SemaCXX/conversion.cpp Tue May  1 15:28:45 2012
@@ -86,9 +86,9 @@
   // FIXME: We should warn for non-dependent args (only when the param type is also non-dependent) only once
   // not once for the template + once for every instantiation
   template<typename T>
-  void tmpl(char c = NULL, // expected-warning 3 {{implicit conversion of NULL constant to 'char'}}
+  void tmpl(char c = NULL, // expected-warning 4 {{implicit conversion of NULL constant to 'char'}}
             T a = NULL, // expected-warning {{implicit conversion of NULL constant to 'char'}} \
-                           expected-warning {{implicit conversion of NULL constant to 'int'}}
+                           expected-warning 2 {{implicit conversion of NULL constant to 'int'}}
             T b = 1024) { // expected-warning {{implicit conversion from 'int' to 'char' changes value from 1024 to 0}}
   }
 
@@ -99,6 +99,8 @@
   void func() {
     tmpl<char>(); // expected-note 2 {{in instantiation of default function argument expression for 'tmpl<char>' required here}}
     tmpl<int>(); // expected-note 2 {{in instantiation of default function argument expression for 'tmpl<int>' required here}}
+    // FIXME: We should warn only once for each template instantiation - not once for each call
+    tmpl<int>(); // expected-note 2 {{in instantiation of default function argument expression for 'tmpl<int>' required here}}
     tmpl2<int*>();
   }
 }





More information about the cfe-commits mailing list