1*67e74705SXin Li // RUN: rm -rf %t 2*67e74705SXin Li // RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -x c++ -I%S/Inputs/merge-using-decls -verify %s -DORDER=1 3*67e74705SXin Li // RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -x c++ -I%S/Inputs/merge-using-decls -verify %s -DORDER=2 4*67e74705SXin Li 5*67e74705SXin Li #if ORDER == 1 6*67e74705SXin Li #include "a.h" 7*67e74705SXin Li #include "b.h" 8*67e74705SXin Li #else 9*67e74705SXin Li #include "b.h" 10*67e74705SXin Li #include "a.h" 11*67e74705SXin Li #endif 12*67e74705SXin Li 13*67e74705SXin Li struct Y { 14*67e74705SXin Li int value; // expected-note 0-1{{target of using}} 15*67e74705SXin Li typedef int type; // expected-note 0-1{{target of using}} 16*67e74705SXin Li }; 17*67e74705SXin Li Use()18*67e74705SXin Litemplate<typename T> int Use() { 19*67e74705SXin Li int k = T().v + T().value; // expected-note 0-2{{instantiation of}} 20*67e74705SXin Li typedef typename T::type I; 21*67e74705SXin Li typedef typename T::t I; 22*67e74705SXin Li typedef int I; 23*67e74705SXin Li return k; 24*67e74705SXin Li } 25*67e74705SXin Li UseAll()26*67e74705SXin Litemplate<typename T> int UseAll() { 27*67e74705SXin Li return Use<C<T> >() + Use<D<T> >() + Use<E<T> >() + Use<F<T> >(); // expected-note 0-2{{instantiation of}} 28*67e74705SXin Li } 29*67e74705SXin Li 30*67e74705SXin Li template int UseAll<YA>(); 31*67e74705SXin Li template int UseAll<YB>(); 32*67e74705SXin Li template int UseAll<Y>(); 33*67e74705SXin Li 34*67e74705SXin Li // Which of these two sets of diagnostics is chosen is not important. It's OK 35*67e74705SXin Li // if this varies with ORDER, but it must be consistent across runs. 36*67e74705SXin Li #if ORDER == 1 37*67e74705SXin Li // Here, we're instantiating the definition from 'A' and merging the definition 38*67e74705SXin Li // from 'B' into it. 39*67e74705SXin Li 40*67e74705SXin Li // [email protected]:* {{'E::value' from module 'B' is not present in definition of 'E<T>' in module 'A'}} 41*67e74705SXin Li // [email protected]:* {{'E::v' from module 'B' is not present in definition of 'E<T>' in module 'A'}} 42*67e74705SXin Li 43*67e74705SXin Li // [email protected]:* {{'F::type' from module 'B' is not present in definition of 'F<T>' in module 'A'}} 44*67e74705SXin Li // [email protected]:* {{'F::t' from module 'B' is not present in definition of 'F<T>' in module 'A'}} 45*67e74705SXin Li // [email protected]:* {{'F::value' from module 'B' is not present in definition of 'F<T>' in module 'A'}} 46*67e74705SXin Li // [email protected]:* {{'F::v' from module 'B' is not present in definition of 'F<T>' in module 'A'}} 47*67e74705SXin Li 48*67e74705SXin Li // [email protected]:* +{{does not match}} 49*67e74705SXin Li #else 50*67e74705SXin Li // Here, we're instantiating the definition from 'B' and merging the definition 51*67e74705SXin Li // from 'A' into it. 52*67e74705SXin Li 53*67e74705SXin Li // [email protected]:* {{'D::type' from module 'A' is not present in definition of 'D<T>' in module 'B'}} 54*67e74705SXin Li // [email protected]:* {{'D::value' from module 'A' is not present in definition of 'D<T>' in module 'B'}} 55*67e74705SXin Li // [email protected]:* 2{{'typename' keyword used on a non-type}} 56*67e74705SXin Li // [email protected]:* 2{{dependent using declaration resolved to type without 'typename'}} 57*67e74705SXin Li 58*67e74705SXin Li // [email protected]:* {{'E::type' from module 'A' is not present in definition of 'E<T>' in module 'B'}} 59*67e74705SXin Li // [email protected]:* {{'E::t' from module 'A' is not present in definition of 'E<T>' in module 'B'}} 60*67e74705SXin Li // [email protected]:* {{'E::value' from module 'A' is not present in definition of 'E<T>' in module 'B'}} 61*67e74705SXin Li // [email protected]:* {{'E::v' from module 'A' is not present in definition of 'E<T>' in module 'B'}} 62*67e74705SXin Li // [email protected]:* 2{{definition has no member}} 63*67e74705SXin Li 64*67e74705SXin Li // [email protected]:* {{'F::type' from module 'A' is not present in definition of 'F<T>' in module 'B'}} 65*67e74705SXin Li // [email protected]:* {{'F::t' from module 'A' is not present in definition of 'F<T>' in module 'B'}} 66*67e74705SXin Li // [email protected]:* {{'F::value' from module 'A' is not present in definition of 'F<T>' in module 'B'}} 67*67e74705SXin Li // [email protected]:* {{'F::v' from module 'A' is not present in definition of 'F<T>' in module 'B'}} 68*67e74705SXin Li 69*67e74705SXin Li // [email protected]:* +{{does not match}} 70*67e74705SXin Li // [email protected]:* +{{target of using}} 71*67e74705SXin Li #endif 72