2 // RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -x c++ -I%S/Inputs/merge-using-decls -verify %s -DORDER=1
3 // RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -x c++ -I%S/Inputs/merge-using-decls -verify -std=c++98 %s -DORDER=1
4 // RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -x c++ -I%S/Inputs/merge-using-decls -verify -std=c++11 %s -DORDER=1
5 // RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -x c++ -I%S/Inputs/merge-using-decls -verify -std=c++17 %s -DORDER=1
6 // RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -x c++ -I%S/Inputs/merge-using-decls -verify %s -DORDER=2
7 // RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -x c++ -I%S/Inputs/merge-using-decls -verify -std=c++98 %s -DORDER=2
8 // RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -x c++ -I%S/Inputs/merge-using-decls -verify -std=c++11 %s -DORDER=2
9 // RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -x c++ -I%S/Inputs/merge-using-decls -verify -std=c++17 %s -DORDER=2
20 int value
; // expected-note 0-1{{target of using}}
21 typedef int type
; // expected-note 0-1{{target of using}}
24 template<typename T
> int Use() {
25 int k
= T().v
+ T().value
; // expected-note 0-2{{instantiation of}}
26 typedef typename
T::type I
;
27 typedef typename
T::t I
;
32 template<typename T
> int UseAll() {
33 #if __cplusplus <= 199711L // C++11 does not allow access declarations
34 return Use
<C
<T
> >() + Use
<D
<T
> >() + Use
<E
<T
> >() + Use
<F
<T
> >(); // expected-note 0-2{{instantiation of}}
36 return Use
<C
<T
> >() + Use
<D
<T
> >() + Use
<F
<T
> >(); // expected-note 0-2{{instantiation of}}
40 template int UseAll
<YA
>();
41 template int UseAll
<YB
>();
42 template int UseAll
<Y
>();
44 #if __cplusplus >= 201702L
46 q
.f(q
); // expected-error {{ambiguous}}
48 // expected-note@a.h:* {{candidate function}}
49 // expected-note@a.h:* {{candidate function}}
51 // expected-note@b.h:* {{candidate function}}
52 // expected-note@b.h:* {{candidate function}}
57 // Which of these two sets of diagnostics is chosen is not important. It's OK
58 // if this varies with ORDER, but it must be consistent across runs.
60 // Here, we're instantiating the definition from 'A' and merging the definition
63 #if __cplusplus <= 199711L // C++11 does not allow access declarations
64 // expected-error@b.h:* {{'E::value' from module 'B' is not present in definition of 'E<T>' in module 'A'}}
65 // expected-error@b.h:* {{'E::v' from module 'B' is not present in definition of 'E<T>' in module 'A'}}
68 // expected-error@b.h:* {{'F::type' from module 'B' is not present in definition of 'F<T>' in module 'A'}}
69 // expected-error@b.h:* {{'F::t' from module 'B' is not present in definition of 'F<T>' in module 'A'}}
70 // expected-error@b.h:* {{'F::value' from module 'B' is not present in definition of 'F<T>' in module 'A'}}
71 // expected-error@b.h:* {{'F::v' from module 'B' is not present in definition of 'F<T>' in module 'A'}}
73 // expected-note@a.h:* +{{does not match}}
75 // Here, we're instantiating the definition from 'B' and merging the definition
78 // expected-error@a.h:* {{'D::type' from module 'A' is not present in definition of 'D<T>' in module 'B'}}
79 // expected-error@a.h:* {{'D::value' from module 'A' is not present in definition of 'D<T>' in module 'B'}}
80 // expected-error@b.h:* 2{{'typename' keyword used on a non-type}}
81 // expected-error@b.h:* 2{{dependent using declaration resolved to type without 'typename'}}
83 #if __cplusplus <= 199711L // C++11 does not allow access declarations
84 // expected-error@a.h:* {{'E::type' from module 'A' is not present in definition of 'E<T>' in module 'B'}}
85 // expected-error@a.h:* {{'E::t' from module 'A' is not present in definition of 'E<T>' in module 'B'}}
86 // expected-error@a.h:* {{'E::value' from module 'A' is not present in definition of 'E<T>' in module 'B'}}
87 // expected-error@a.h:* {{'E::v' from module 'A' is not present in definition of 'E<T>' in module 'B'}}
88 // expected-note@b.h:* 2{{definition has no member}}
92 // expected-error@a.h:* {{'F::type' from module 'A' is not present in definition of 'F<T>' in module 'B'}}
93 // expected-error@a.h:* {{'F::t' from module 'A' is not present in definition of 'F<T>' in module 'B'}}
94 // expected-error@a.h:* {{'F::value' from module 'A' is not present in definition of 'F<T>' in module 'B'}}
95 // expected-error@a.h:* {{'F::v' from module 'A' is not present in definition of 'F<T>' in module 'B'}}
97 // expected-note@b.h:* +{{does not match}}
98 // expected-note@b.h:* +{{target of using}}