diff options
author | Douglas Gregor <dgregor@apple.com> | 2013-03-14 20:44:43 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2013-03-14 20:44:43 +0000 |
commit | 7f99d5c54135ae812a7cb7c86f135086d3d65031 (patch) | |
tree | b0f4b302d2b9f2dd4291e0e895ef14b9b26b9fa8 | |
parent | 836e7c9357b312fd1ee5c90898ce2c81bb384997 (diff) |
[PR15513/<rdar://problem/13409707>] Template arguments in diagnostics aren't always known at compile time.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177110 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/AST/ASTDiagnostic.cpp | 2 | ||||
-rw-r--r-- | test/Misc/diag-template-diffing-cxx98.cpp | 12 |
2 files changed, 12 insertions, 2 deletions
diff --git a/lib/AST/ASTDiagnostic.cpp b/lib/AST/ASTDiagnostic.cpp index d67423ed3d..e21caa9af2 100644 --- a/lib/AST/ASTDiagnostic.cpp +++ b/lib/AST/ASTDiagnostic.cpp @@ -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; diff --git a/test/Misc/diag-template-diffing-cxx98.cpp b/test/Misc/diag-template-diffing-cxx98.cpp index cd40ccc374..f374fbc417 100644 --- a/test/Misc/diag-template-diffing-cxx98.cpp +++ b/test/Misc/diag-template-diffing-cxx98.cpp @@ -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; + } +} |