diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2017-04-21 01:15:13 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2017-04-21 01:15:13 +0000 |
commit | 2195ec9ad4ba7dc363762e3aaf7af93085cb30e1 (patch) | |
tree | fbce0b2f4821e1e0b623bbf40d9bcf4d5b9c080a /clang/test/Modules/template-default-args.cpp | |
parent | 49ee2a0f288d8dbec52aa882d7ae583be07edba9 (diff) | |
download | bcm5719-llvm-2195ec9ad4ba7dc363762e3aaf7af93085cb30e1.tar.gz bcm5719-llvm-2195ec9ad4ba7dc363762e3aaf7af93085cb30e1.zip |
[modules] Properly look up the owning module for an instantiation of a merged template.
When looking for the template instantiation pattern of a templated entity,
consistently select the definition of the pattern if there is one. This means
we'll pick the same owning module when we start instantiating a template that
we'll later pick when determining which modules are visible during that
instantiation.
This reinstates r300650, reverted in r300659, with a fix for a regression
reported by Chandler after commit.
llvm-svn: 300938
Diffstat (limited to 'clang/test/Modules/template-default-args.cpp')
-rw-r--r-- | clang/test/Modules/template-default-args.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/clang/test/Modules/template-default-args.cpp b/clang/test/Modules/template-default-args.cpp index 9d16cbf4342..c51cb284088 100644 --- a/clang/test/Modules/template-default-args.cpp +++ b/clang/test/Modules/template-default-args.cpp @@ -44,3 +44,20 @@ H<> h; // expected-error {{default argument of 'H' must be imported from module I<> i; L<> *l; END + +namespace DeferredLookup { + template<typename T, typename U = T> using X = U; + template<typename T> void f() { (void) X<T>(); } + template<typename T> int n = X<T>(); // expected-warning {{extension}} + template<typename T> struct S { X<T> xt; enum E : int; }; + template<typename T> enum S<T>::E : int { a = X<T>() }; + + void test() { + f<int>(); + n<int> = 1; + S<int> s; + S<int>::E e = S<int>::E::a; + + Indirect::B<int>::C<int> indirect; + } +} |