diff options
author | Richard Trieu <rtrieu@google.com> | 2013-07-20 03:49:02 +0000 |
---|---|---|
committer | Richard Trieu <rtrieu@google.com> | 2013-07-20 03:49:02 +0000 |
commit | 8ed6f2aacfe83bb823de2eb7975e704b89d1264b (patch) | |
tree | 3748b85516de6c1884cbfab5de85d3ad6d6649a3 /clang/test/Misc/diag-template-diffing.cpp | |
parent | 08905dd60becc00d1fc65b3048f80891948de66e (diff) | |
download | bcm5719-llvm-8ed6f2aacfe83bb823de2eb7975e704b89d1264b.tar.gz bcm5719-llvm-8ed6f2aacfe83bb823de2eb7975e704b89d1264b.zip |
If a default argument is a dependent type, get the real type from the desugared
template. Passing around dependent types can lead to integral arguments that
cannot be evaluated.
llvm-svn: 186757
Diffstat (limited to 'clang/test/Misc/diag-template-diffing.cpp')
-rw-r--r-- | clang/test/Misc/diag-template-diffing.cpp | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/clang/test/Misc/diag-template-diffing.cpp b/clang/test/Misc/diag-template-diffing.cpp index cacc5c97fd1..722ce98ecff 100644 --- a/clang/test/Misc/diag-template-diffing.cpp +++ b/clang/test/Misc/diag-template-diffing.cpp @@ -935,10 +935,10 @@ namespace DependentDefault { B<int, char> b3; b1 = b2; // CHECK-ELIDE-NOTREE: no viable overloaded '=' - // CHECK-ELIDE-NOTREE: no known conversion from 'B<char, (default) Trait<T>::Ty>' to 'B<int, int>' + // CHECK-ELIDE-NOTREE: no known conversion from 'B<char, [...]>' to 'B<int, [...]>' b3 = b1; // CHECK-ELIDE-NOTREE: no viable overloaded '=' - // CHECK-ELIDE-NOTREE: no known conversion from 'B<[...], (default) Trait<T>::Ty>' to 'B<[...], char>' + // CHECK-ELIDE-NOTREE: no known conversion from 'B<[...], (default) int>' to 'B<[...], char>' b2 = b3; // CHECK-ELIDE-NOTREE: no viable overloaded '=' // CHECK-ELIDE-NOTREE: no known conversion from 'B<int, char>' to 'B<char, int>' @@ -1029,6 +1029,28 @@ namespace PointerArguments { } } +namespace DependentInt { + template<int Num> struct INT; + + template <class CLASS, class Int_wrapper = INT<CLASS::val> > + struct C; + + struct N { + static const int val = 1; + }; + + template <class M_T> + struct M {}; + + void test() { + using T1 = M<C<int, INT<0>>>; + using T2 = M<C<N>>; + T2 p; + T1 x = p; + // CHECK-ELIDE-NOTREE: no viable conversion from 'M<C<struct DependentInt::N, INT<1>>>' to 'M<C<int, INT<0>>>' + } +} + // CHECK-ELIDE-NOTREE: {{[0-9]*}} errors generated. // CHECK-NOELIDE-NOTREE: {{[0-9]*}} errors generated. // CHECK-ELIDE-TREE: {{[0-9]*}} errors generated. |