From 2195ec9ad4ba7dc363762e3aaf7af93085cb30e1 Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Fri, 21 Apr 2017 01:15:13 +0000 Subject: [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 --- clang/test/Modules/template-default-args.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'clang/test/Modules/template-default-args.cpp') 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 using X = U; + template void f() { (void) X(); } + template int n = X(); // expected-warning {{extension}} + template struct S { X xt; enum E : int; }; + template enum S::E : int { a = X() }; + + void test() { + f(); + n = 1; + S s; + S::E e = S::E::a; + + Indirect::B::C indirect; + } +} -- cgit v1.2.3