]> granicus.if.org Git - clang/commitdiff
Workaround a miscompile in 483.xalancbmk while we figure it out.
authorDavid Blaikie <dblaikie@gmail.com>
Tue, 1 May 2012 20:28:45 +0000 (20:28 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Tue, 1 May 2012 20:28:45 +0000 (20:28 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155938 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaExpr.cpp
test/SemaCXX/conversion.cpp

index 4ed588565f1a3af9e69ada7edc0fda7537897bec..aaf579eda6fb24d21401994a6aff83ea6b27327a 100644 (file)
@@ -3302,7 +3302,6 @@ ExprResult Sema::BuildCXXDefaultArgExpr(SourceLocation CallLoc,
 
     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));
   }
index da78510c6418809ba8790e5c88e1ae039a8c52e7..b019536e1a3ee666a38279a97fb2aa0273472e01 100644 (file)
@@ -86,9 +86,9 @@ namespace test4 {
   // 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 {{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 @@ namespace test4 {
   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*>();
   }
 }