]> granicus.if.org Git - clang/commitdiff
[PR15513/<rdar://problem/13409707>] Template arguments in diagnostics aren't always...
authorDouglas Gregor <dgregor@apple.com>
Thu, 14 Mar 2013 20:44:43 +0000 (20:44 +0000)
committerDouglas Gregor <dgregor@apple.com>
Thu, 14 Mar 2013 20:44:43 +0000 (20:44 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177110 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/ASTDiagnostic.cpp
test/Misc/diag-template-diffing-cxx98.cpp

index d67423ed3d29dfe20998485fa76254e7f688bb70..e21caa9af2663f1f760bd7f4b4eea4f403cbd1de 100644 (file)
@@ -1093,7 +1093,7 @@ class TemplateDiff {
     Expr::EvalResult FromResult, ToResult;
     if (!FromExpr->EvaluateAsRValue(FromResult, Context) ||
         !ToExpr->EvaluateAsRValue(ToResult, Context))
-      assert(0 && "Template arguments must be known at compile time.");
+      return false;
 
     APValue &FromVal = FromResult.Val;
     APValue &ToVal = ToResult.Val;
index cd40ccc3748a6ad4923f2d7d05a2d274c3fa7e5f..f374fbc417953c442c2e839a0002ab0a795b13c8 100644 (file)
@@ -4,4 +4,14 @@ namespace PR14342 {
   template<typename T, char a> struct X {};
   X<int, 1> x = X<long, 257>();
   // CHECK: error: no viable conversion from 'X<long, [...]>' to 'X<int, [...]>'
-}
\ No newline at end of file
+}
+
+namespace PR15513 {
+  template <int x, int y = x+1>
+  class A {};
+
+  void foo(A<0> &M) {
+    // CHECK: no viable conversion from 'A<[...], (default) x + 1>' to 'A<[...], 0>'
+    A<0, 0> N = M;
+  }
+}