diff options
author | Richard Trieu <rtrieu@google.com> | 2013-03-15 23:55:09 +0000 |
---|---|---|
committer | Richard Trieu <rtrieu@google.com> | 2013-03-15 23:55:09 +0000 |
commit | 64ab30392da6818717c2a6fd530559b472dedf2d (patch) | |
tree | ca371bb503e5ffee500dba1a30c26d55e74987ab /clang/test/Misc/diag-template-diffing-cxx98.cpp | |
parent | 6482d2305efbfdac07b51793a5a8051fefba0f1f (diff) | |
download | bcm5719-llvm-64ab30392da6818717c2a6fd530559b472dedf2d.tar.gz bcm5719-llvm-64ab30392da6818717c2a6fd530559b472dedf2d.zip |
Improve template diffing handling of default integer values.
When the template argument is both default and value dependent, the expression
retrieved for the default argument cannot be evaluated, thus never matching
any argument value. To get the proper value, get the template argument
from the desugared template specialization. Also, output the original
expression to provide more information about the argument mismatch.
llvm-svn: 177209
Diffstat (limited to 'clang/test/Misc/diag-template-diffing-cxx98.cpp')
-rw-r--r-- | clang/test/Misc/diag-template-diffing-cxx98.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/clang/test/Misc/diag-template-diffing-cxx98.cpp b/clang/test/Misc/diag-template-diffing-cxx98.cpp index f374fbc4179..9d0439c2828 100644 --- a/clang/test/Misc/diag-template-diffing-cxx98.cpp +++ b/clang/test/Misc/diag-template-diffing-cxx98.cpp @@ -11,7 +11,23 @@ namespace PR15513 { class A {}; void foo(A<0> &M) { - // CHECK: no viable conversion from 'A<[...], (default) x + 1>' to 'A<[...], 0>' + // CHECK: no viable conversion from 'A<[...], (default) x + 1 aka 1>' to 'A<[...], 0>' A<0, 0> N = M; + // CHECK: no viable conversion from 'A<0, [...]>' to 'A<1, [...]>' + A<1, 1> O = M; } } + +namespace default_args { + template <int x, int y = 1+1, int z = 2> + class A {}; + + void foo(A<0> &M) { + // CHECK: no viable conversion from 'A<[...], (default) 1 + 1 aka 2, (default) 2>' to 'A<[...], 0, 0>' + A<0, 0, 0> N = M; + + // CHECK: no viable conversion from 'A<[2 * ...], (default) 2>' to 'A<[2 * ...], 0>' + A<0, 2, 0> N2 = M; + } + +} |