1 // Clear and create directories
2 // RUN: rm -rf %t
3 // RUN: mkdir %t
4 // RUN: mkdir %t/cache
5 // RUN: mkdir %t/Inputs
6 
7 // Build first header file
8 // RUN: echo "#define FIRST" >> %t/Inputs/first.h
9 // RUN: cat %s               >> %t/Inputs/first.h
10 
11 // Build second header file
12 // RUN: echo "#define SECOND" >> %t/Inputs/second.h
13 // RUN: cat %s                >> %t/Inputs/second.h
14 
15 // Test that each header can compile
16 // RUN: %clang_cc1 -fsyntax-only -x c++ -std=c++1z %t/Inputs/first.h
17 // RUN: %clang_cc1 -fsyntax-only -x c++ -std=c++1z %t/Inputs/second.h
18 
19 // Build module map file
20 // RUN: echo "module FirstModule {"     >> %t/Inputs/module.map
21 // RUN: echo "    header \"first.h\""   >> %t/Inputs/module.map
22 // RUN: echo "}"                        >> %t/Inputs/module.map
23 // RUN: echo "module SecondModule {"    >> %t/Inputs/module.map
24 // RUN: echo "    header \"second.h\""  >> %t/Inputs/module.map
25 // RUN: echo "}"                        >> %t/Inputs/module.map
26 
27 // Run test
28 // RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/cache -x c++ -I%t/Inputs -verify %s -std=c++1z
29 
30 #if !defined(FIRST) && !defined(SECOND)
31 #include "first.h"
32 #include "second.h"
33 #endif
34 
35 // Used for testing
36 #if defined(FIRST)
37 #define ACCESS public:
38 #elif defined(SECOND)
39 #define ACCESS private:
40 #endif
41 
42 namespace AccessSpecifiers {
43 #if defined(FIRST)
44 struct S1 {
45 };
46 #elif defined(SECOND)
47 struct S1 {
48   private:
49 };
50 #else
51 S1 s1;
52 // [email protected]:* {{'AccessSpecifiers::S1' has different definitions in different modules; first difference is definition in module 'SecondModule' found private access specifier}}
53 // [email protected]:* {{but in 'FirstModule' found end of class}}
54 #endif
55 
56 #if defined(FIRST)
57 struct S2 {
58   public:
59 };
60 #elif defined(SECOND)
61 struct S2 {
62   protected:
63 };
64 #else
65 S2 s2;
66 // [email protected]:* {{'AccessSpecifiers::S2' has different definitions in different modules; first difference is definition in module 'SecondModule' found protected access specifier}}
67 // [email protected]:* {{but in 'FirstModule' found public access specifier}}
68 #endif
69 
70 #define DECLS \
71 public:       \
72 private:      \
73 protected:
74 
75 #if defined(FIRST) || defined(SECOND)
76 struct Valid1 {
77   DECLS
78 };
79 #else
80 Valid1 v1;
81 #endif
82 
83 #if defined(FIRST) || defined(SECOND)
84 struct Invalid1 {
85   DECLS
86   ACCESS
87 };
88 #else
89 Invalid1 i1;
90 // [email protected]:* {{'AccessSpecifiers::Invalid1' has different definitions in different modules; first difference is definition in module 'SecondModule' found private access specifier}}
91 // [email protected]:* {{but in 'FirstModule' found public access specifier}}
92 #endif
93 
94 #undef DECLS
95 } // namespace AccessSpecifiers
96 
97 namespace StaticAssert {
98 #if defined(FIRST)
99 struct S1 {
100   static_assert(1 == 1, "First");
101 };
102 #elif defined(SECOND)
103 struct S1 {
104   static_assert(1 == 1, "Second");
105 };
106 #else
107 S1 s1;
108 // [email protected]:* {{'StaticAssert::S1' has different definitions in different modules; first difference is definition in module 'SecondModule' found static assert with message}}
109 // [email protected]:* {{but in 'FirstModule' found static assert with different message}}
110 #endif
111 
112 #if defined(FIRST)
113 struct S2 {
114   static_assert(2 == 2, "Message");
115 };
116 #elif defined(SECOND)
117 struct S2 {
118   static_assert(2 == 2);
119 };
120 #else
121 S2 s2;
122 // [email protected]:* {{'StaticAssert::S2' has different definitions in different modules; first difference is definition in module 'SecondModule' found static assert with no message}}
123 // [email protected]:* {{but in 'FirstModule' found static assert with message}}
124 #endif
125 
126 #if defined(FIRST)
127 struct S3 {
128   static_assert(3 == 3, "Message");
129 };
130 #elif defined(SECOND)
131 struct S3 {
132   static_assert(3 != 4, "Message");
133 };
134 #else
135 S3 s3;
136 // [email protected]:* {{'StaticAssert::S3' has different definitions in different modules; first difference is definition in module 'SecondModule' found static assert with condition}}
137 // [email protected]:* {{but in 'FirstModule' found static assert with different condition}}
138 #endif
139 
140 #if defined(FIRST)
141 struct S4 {
142   static_assert(4 == 4, "Message");
143 };
144 #elif defined(SECOND)
145 struct S4 {
146   public:
147 };
148 #else
149 S4 s4;
150 // [email protected]:* {{'StaticAssert::S4' has different definitions in different modules; first difference is definition in module 'SecondModule' found public access specifier}}
151 // [email protected]:* {{but in 'FirstModule' found static assert}}
152 #endif
153 
154 #define DECLS                       \
155   static_assert(4 == 4, "Message"); \
156   static_assert(5 == 5);
157 
158 #if defined(FIRST) || defined(SECOND)
159 struct Valid1 {
160   DECLS
161 };
162 #else
163 Valid1 v1;
164 #endif
165 
166 #if defined(FIRST) || defined(SECOND)
167 struct Invalid1 {
168   DECLS
169   ACCESS
170 };
171 #else
172 Invalid1 i1;
173 // [email protected]:* {{'StaticAssert::Invalid1' has different definitions in different modules; first difference is definition in module 'SecondModule' found private access specifier}}
174 // [email protected]:* {{but in 'FirstModule' found public access specifier}}
175 #endif
176 #undef DECLS
177 }  // namespace StaticAssert
178 
179 namespace Field {
180 #if defined(FIRST)
181 struct S1 {
182   int x;
183   private:
184   int y;
185 };
186 #elif defined(SECOND)
187 struct S1 {
188   int x;
189   int y;
190 };
191 #else
192 S1 s1;
193 // [email protected]:* {{'Field::S1' has different definitions in different modules; first difference is definition in module 'SecondModule' found field}}
194 // [email protected]:* {{but in 'FirstModule' found private access specifier}}
195 #endif
196 
197 #if defined(FIRST)
198 struct S2 {
199   int x;
200   int y;
201 };
202 #elif defined(SECOND)
203 struct S2 {
204   int y;
205   int x;
206 };
207 #else
208 S2 s2;
209 // [email protected]:* {{'Field::S2' has different definitions in different modules; first difference is definition in module 'SecondModule' found field 'y'}}
210 // [email protected]:* {{but in 'FirstModule' found field 'x'}}
211 #endif
212 
213 #if defined(FIRST)
214 struct S3 {
215   double x;
216 };
217 #elif defined(SECOND)
218 struct S3 {
219   int x;
220 };
221 #else
222 S3 s3;
223 // [email protected]:* {{'Field::S3::x' from module 'FirstModule' is not present in definition of 'Field::S3' in module 'SecondModule'}}
224 // [email protected]:* {{declaration of 'x' does not match}}
225 #endif
226 
227 #if defined(FIRST)
228 typedef int A;
229 struct S4 {
230   A x;
231 };
232 
233 struct S5 {
234   A x;
235 };
236 #elif defined(SECOND)
237 typedef int B;
238 struct S4 {
239   B x;
240 };
241 
242 struct S5 {
243   int x;
244 };
245 #else
246 S4 s4;
247 // [email protected]:* {{'Field::S4' has different definitions in different modules; first difference is definition in module 'SecondModule' found field 'x' with type 'Field::B' (aka 'int')}}
248 // [email protected]:* {{but in 'FirstModule' found field 'x' with type 'Field::A' (aka 'int')}}
249 
250 S5 s5;
251 // [email protected]:* {{'Field::S5' has different definitions in different modules; first difference is definition in module 'SecondModule' found field 'x' with type 'int'}}
252 // [email protected]:* {{but in 'FirstModule' found field 'x' with type 'Field::A' (aka 'int')}}
253 #endif
254 
255 #if defined(FIRST)
256 struct S6 {
257   unsigned x;
258 };
259 #elif defined(SECOND)
260 struct S6 {
261   unsigned x : 1;
262 };
263 #else
264 S6 s6;
265 // [email protected]:* {{'Field::S6' has different definitions in different modules; first difference is definition in module 'SecondModule' found bitfield 'x'}}
266 // [email protected]:* {{but in 'FirstModule' found non-bitfield 'x'}}
267 #endif
268 
269 #if defined(FIRST)
270 struct S7 {
271   unsigned x : 2;
272 };
273 #elif defined(SECOND)
274 struct S7 {
275   unsigned x : 1;
276 };
277 #else
278 S7 s7;
279 // [email protected]:* {{'Field::S7' has different definitions in different modules; first difference is definition in module 'SecondModule' found bitfield 'x' with one width expression}}
280 // [email protected]:* {{but in 'FirstModule' found bitfield 'x' with different width expression}}
281 #endif
282 
283 #if defined(FIRST)
284 struct S8 {
285   unsigned x : 2;
286 };
287 #elif defined(SECOND)
288 struct S8 {
289   unsigned x : 1 + 1;
290 };
291 #else
292 S8 s8;
293 // [email protected]:* {{'Field::S8' has different definitions in different modules; first difference is definition in module 'SecondModule' found bitfield 'x' with one width expression}}
294 // [email protected]:* {{but in 'FirstModule' found bitfield 'x' with different width expression}}
295 #endif
296 
297 #if defined(FIRST)
298 struct S9 {
299   mutable int x;
300 };
301 #elif defined(SECOND)
302 struct S9 {
303   int x;
304 };
305 #else
306 S9 s9;
307 // [email protected]:* {{'Field::S9' has different definitions in different modules; first difference is definition in module 'SecondModule' found non-mutable field 'x'}}
308 // [email protected]:* {{but in 'FirstModule' found mutable field 'x'}}
309 #endif
310 
311 #if defined(FIRST)
312 struct S10 {
313   unsigned x = 5;
314 };
315 #elif defined(SECOND)
316 struct S10 {
317   unsigned x;
318 };
319 #else
320 S10 s10;
321 // [email protected]:* {{'Field::S10' has different definitions in different modules; first difference is definition in module 'SecondModule' found field 'x' with no initalizer}}
322 // [email protected]:* {{but in 'FirstModule' found field 'x' with an initializer}}
323 #endif
324 
325 #if defined(FIRST)
326 struct S11 {
327   unsigned x = 5;
328 };
329 #elif defined(SECOND)
330 struct S11 {
331   unsigned x = 7;
332 };
333 #else
334 S11 s11;
335 // [email protected]:* {{'Field::S11' has different definitions in different modules; first difference is definition in module 'SecondModule' found field 'x' with an initializer}}
336 // [email protected]:* {{but in 'FirstModule' found field 'x' with a different initializer}}
337 #endif
338 
339 #if defined(FIRST)
340 struct S12 {
341   unsigned x[5];
342 };
343 #elif defined(SECOND)
344 struct S12 {
345   unsigned x[7];
346 };
347 #else
348 S12 s12;
349 // [email protected]:* {{'Field::S12::x' from module 'FirstModule' is not present in definition of 'Field::S12' in module 'SecondModule'}}
350 // [email protected]:* {{declaration of 'x' does not match}}
351 #endif
352 
353 #if defined(FIRST)
354 struct S13 {
355   unsigned x[7];
356 };
357 #elif defined(SECOND)
358 struct S13 {
359   double x[7];
360 };
361 #else
362 S13 s13;
363 // [email protected]:* {{'Field::S13::x' from module 'FirstModule' is not present in definition of 'Field::S13' in module 'SecondModule'}}
364 // [email protected]:* {{declaration of 'x' does not match}}
365 #endif
366 
367 #define DECLS         \
368   int a;              \
369   int b : 3;          \
370   unsigned c : 1 + 2; \
371   s d;                \
372   double e = 1.0;     \
373   long f[5];
374 
375 #if defined(FIRST) || defined(SECOND)
376 typedef short s;
377 #endif
378 
379 #if defined(FIRST) || defined(SECOND)
380 struct Valid1 {
381   DECLS
382 };
383 #else
384 Valid1 v1;
385 #endif
386 
387 #if defined(FIRST) || defined(SECOND)
388 struct Invalid1 {
389   DECLS
390   ACCESS
391 };
392 #else
393 Invalid1 i1;
394 // [email protected]:* {{'Field::Invalid1' has different definitions in different modules; first difference is definition in module 'SecondModule' found private access specifier}}
395 // [email protected]:* {{but in 'FirstModule' found public access specifier}}
396 #endif
397 #undef DECLS
398 }  // namespace Field
399 
400 namespace Method {
401 #if defined(FIRST)
402 struct S1 {
403   void A() {}
404 };
405 #elif defined(SECOND)
406 struct S1 {
407   private:
408   void A() {}
409 };
410 #else
411 S1 s1;
412 // [email protected]:* {{'Method::S1' has different definitions in different modules; first difference is definition in module 'SecondModule' found private access specifier}}
413 // [email protected]:* {{but in 'FirstModule' found method}}
414 #endif
415 
416 #if defined(FIRST)
417 struct S2 {
418   void A() {}
419   void B() {}
420 };
421 #elif defined(SECOND)
422 struct S2 {
423   void B() {}
424   void A() {}
425 };
426 #else
427 S2 s2;
428 // [email protected]:* {{'Method::S2' has different definitions in different modules; first difference is definition in module 'SecondModule' found method 'B'}}
429 // [email protected]:* {{but in 'FirstModule' found method 'A'}}
430 #endif
431 
432 #if defined(FIRST)
433 struct S3 {
434   static void A() {}
435   void A(int) {}
436 };
437 #elif defined(SECOND)
438 struct S3 {
439   void A(int) {}
440   static void A() {}
441 };
442 #else
443 S3 s3;
444 // [email protected]:* {{'Method::S3' has different definitions in different modules; first difference is definition in module 'SecondModule' found method 'A' is not static}}
445 // [email protected]:* {{but in 'FirstModule' found method 'A' is static}}
446 #endif
447 
448 #if defined(FIRST)
449 struct S4 {
450   virtual void A() {}
451   void B() {}
452 };
453 #elif defined(SECOND)
454 struct S4 {
455   void A() {}
456   virtual void B() {}
457 };
458 #else
459 S4 s4;
460 // [email protected]:* {{'Method::S4' has different definitions in different modules; first difference is definition in module 'SecondModule' found method 'A' is not virtual}}
461 // [email protected]:* {{but in 'FirstModule' found method 'A' is virtual}}
462 #endif
463 
464 #if defined(FIRST)
465 struct S5 {
466   virtual void A() = 0;
467   virtual void B() {};
468 };
469 #elif defined(SECOND)
470 struct S5 {
471   virtual void A() {}
472   virtual void B() = 0;
473 };
474 #else
475 S5 *s5;
476 // [email protected]:* {{'Method::S5' has different definitions in different modules; first difference is definition in module 'SecondModule' found method 'A' is virtual}}
477 // [email protected]:* {{but in 'FirstModule' found method 'A' is pure virtual}}
478 #endif
479 
480 #if defined(FIRST)
481 struct S6 {
482   inline void A() {}
483 };
484 #elif defined(SECOND)
485 struct S6 {
486   void A() {}
487 };
488 #else
489 S6 s6;
490 // [email protected]:* {{'Method::S6' has different definitions in different modules; first difference is definition in module 'SecondModule' found method 'A' is not inline}}
491 // [email protected]:* {{but in 'FirstModule' found method 'A' is inline}}
492 #endif
493 
494 #if defined(FIRST)
495 struct S7 {
496   void A() volatile {}
497   void A() {}
498 };
499 #elif defined(SECOND)
500 struct S7 {
501   void A() {}
502   void A() volatile {}
503 };
504 #else
505 S7 s7;
506 // [email protected]:* {{'Method::S7' has different definitions in different modules; first difference is definition in module 'SecondModule' found method 'A' is not volatile}}
507 // [email protected]:* {{but in 'FirstModule' found method 'A' is volatile}}
508 #endif
509 
510 #if defined(FIRST)
511 struct S8 {
512   void A() const {}
513   void A() {}
514 };
515 #elif defined(SECOND)
516 struct S8 {
517   void A() {}
518   void A() const {}
519 };
520 #else
521 S8 s8;
522 // [email protected]:* {{'Method::S8' has different definitions in different modules; first difference is definition in module 'SecondModule' found method 'A' is not const}}
523 // [email protected]:* {{but in 'FirstModule' found method 'A' is const}}
524 #endif
525 
526 #if defined(FIRST)
527 struct S9 {
528   void A(int x) {}
529   void A(int x, int y) {}
530 };
531 #elif defined(SECOND)
532 struct S9 {
533   void A(int x, int y) {}
534   void A(int x) {}
535 };
536 #else
537 S9 s9;
538 // [email protected]:* {{'Method::S9' has different definitions in different modules; first difference is definition in module 'SecondModule' found method 'A' that has 2 parameters}}
539 // [email protected]:* {{but in 'FirstModule' found method 'A' that has 1 parameter}}
540 #endif
541 
542 #if defined(FIRST)
543 struct S10 {
544   void A(int x) {}
545   void A(float x) {}
546 };
547 #elif defined(SECOND)
548 struct S10 {
549   void A(float x) {}
550   void A(int x) {}
551 };
552 #else
553 S10 s10;
554 // [email protected]:* {{'Method::S10' has different definitions in different modules; first difference is definition in module 'SecondModule' found method 'A' with 1st parameter of type 'float'}}
555 // [email protected]:* {{but in 'FirstModule' found method 'A' with 1st parameter of type 'int'}}
556 #endif
557 
558 #if defined(FIRST)
559 struct S11 {
560   void A(int x);
561 };
562 #elif defined(SECOND)
563 struct S11 {
564   void A(int y);
565 };
566 #else
567 S11 s11;
568 // [email protected]:* {{'Method::S11' has different definitions in different modules; first difference is definition in module 'SecondModule' found method 'A' with 1st parameter named 'y'}}
569 // [email protected]:* {{but in 'FirstModule' found method 'A' with 1st parameter named 'x'}}
570 #endif
571 
572 #if defined(FIRST)
573 struct S12 {
574   void A(int x);
575 };
576 #elif defined(SECOND)
577 struct S12 {
578   void A(int x = 1);
579 };
580 #else
581 S12 s12;
582 // [email protected]:* {{'Method::S12' has different definitions in different modules; first difference is definition in module 'SecondModule' found method 'A' with 1st parameter without a default argument}}
583 // [email protected]:* {{but in 'FirstModule' found method 'A' with 1st parameter with a default argument}}
584 #endif
585 
586 #if defined(FIRST)
587 struct S13 {
588   void A(int x = 1 + 0);
589 };
590 #elif defined(SECOND)
591 struct S13 {
592   void A(int x = 1);
593 };
594 #else
595 S13 s13;
596 // [email protected]:* {{'Method::S13' has different definitions in different modules; first difference is definition in module 'SecondModule' found method 'A' with 1st parameter with a default argument}}
597 // [email protected]:* {{but in 'FirstModule' found method 'A' with 1st parameter with a different default argument}}
598 #endif
599 
600 #if defined(FIRST)
601 struct S14 {
602   void A(int x[2]);
603 };
604 #elif defined(SECOND)
605 struct S14 {
606   void A(int x[3]);
607 };
608 #else
609 S14 s14;
610 // [email protected]:* {{'Method::S14' has different definitions in different modules; first difference is definition in module 'SecondModule' found method 'A' with 1st parameter of type 'int *' decayed from 'int [3]'}}
611 // [email protected]:* {{but in 'FirstModule' found method 'A' with 1st parameter of type 'int *' decayed from 'int [2]'}}
612 #endif
613 
614 #if defined(FIRST)
615 struct S15 {
616   int A() { return 0; }
617 };
618 #elif defined(SECOND)
619 struct S15 {
620   long A() { return 0; }
621 };
622 #else
623 S15 s15;
624 // [email protected]:* {{'Method::S15::A' from module 'FirstModule' is not present in definition of 'Method::S15' in module 'SecondModule'}}
625 // [email protected]:* {{declaration of 'A' does not match}}
626 #endif
627 
628 #define DECLS            \
629   void A();              \
630   static void B();       \
631   virtual void C();      \
632   virtual void D() = 0;  \
633   inline void E();       \
634   void F() const;        \
635   void G() volatile;     \
636   void H(int x);         \
637   void I(int x = 5 + 5); \
638   void J(int);           \
639   void K(int x[2]);      \
640   int L();
641 
642 #if defined(FIRST) || defined(SECOND)
643 struct Valid1 {
644   DECLS
645 };
646 #else
647 Valid1* v1;
648 #endif
649 
650 #if defined(FIRST) || defined(SECOND)
651 struct Invalid1 {
652   DECLS
653   ACCESS
654 };
655 #else
656 Invalid1* i1;
657 // [email protected]:* {{'Method::Invalid1' has different definitions in different modules; first difference is definition in module 'SecondModule' found private access specifier}}
658 // [email protected]:* {{but in 'FirstModule' found public access specifier}}
659 #endif
660 #undef DECLS
661 }  // namespace Method
662 
663 namespace Constructor {
664 #if defined(FIRST)
665 struct S1 {
666   S1() {}
667   void foo() {}
668 };
669 #elif defined(SECOND)
670 struct S1 {
671   void foo() {}
672   S1() {}
673 };
674 #else
675 S1 s1;
676 // [email protected]:* {{'Constructor::S1' has different definitions in different modules; first difference is definition in module 'SecondModule' found method 'foo'}}
677 // [email protected]:* {{but in 'FirstModule' found constructor}}
678 #endif
679 
680 #if defined(FIRST)
681 struct S2 {
682   S2(int) {}
683   S2(int, int) {}
684 };
685 #elif defined(SECOND)
686 struct S2 {
687   S2(int, int) {}
688   S2(int) {}
689 };
690 #else
691 S2* s2;
692 // [email protected]:* {{'Constructor::S2' has different definitions in different modules; first difference is definition in module 'SecondModule' found constructor that has 2 parameters}}
693 // [email protected]:* {{but in 'FirstModule' found constructor that has 1 parameter}}
694 #endif
695 
696 #define DECLS(CLASS) \
697   CLASS(int);        \
698   CLASS(double);     \
699   CLASS(int, int);
700 
701 #if defined(FIRST) || defined(SECOND)
702 struct Valid1 {
703   DECLS(Valid1)
704 };
705 #else
706 Valid1* v1;
707 #endif
708 
709 #if defined(FIRST) || defined(SECOND)
710 struct Invalid1 {
711   DECLS(Invalid1)
712   ACCESS
713 };
714 #else
715 Invalid1* i1;
716 // [email protected]:* {{'Constructor::Invalid1' has different definitions in different modules; first difference is definition in module 'SecondModule' found private access specifier}}
717 // [email protected]:* {{but in 'FirstModule' found public access specifier}}
718 #endif
719 #undef DECLS
720 }  // namespace Constructor
721 
722 namespace Destructor {
723 #if defined(FIRST)
724 struct S1 {
725   ~S1() {}
726   S1() {}
727 };
728 #elif defined(SECOND)
729 struct S1 {
730   S1() {}
731   ~S1() {}
732 };
733 #else
734 S1 s1;
735 // [email protected]:* {{'Destructor::S1' has different definitions in different modules; first difference is definition in module 'SecondModule' found constructor}}
736 // [email protected]:* {{but in 'FirstModule' found destructor}}
737 #endif
738 
739 #if defined(FIRST)
740 struct S2 {
741   virtual ~S2() {}
742   void foo() {}
743 };
744 #elif defined(SECOND)
745 struct S2 {
746   ~S2() {}
747   virtual void foo() {}
748 };
749 #else
750 S2 s2;
751 // [email protected]:* {{'Destructor::S2' has different definitions in different modules; first difference is definition in module 'SecondModule' found destructor is not virtual}}
752 // [email protected]:* {{but in 'FirstModule' found destructor is virtual}}
753 #endif
754 
755 #if defined(FIRST) || defined(SECOND)
756 struct Valid1 {
757   ~Valid1();
758 };
759 #else
760 Valid1 v1;
761 #endif
762 
763 #if defined(FIRST) || defined(SECOND)
764 struct Invalid1 {
765   ~Invalid1();
766   ACCESS
767 };
768 #else
769 Invalid1 i1;
770 // [email protected]:* {{'Destructor::Invalid1' has different definitions in different modules; first difference is definition in module 'SecondModule' found private access specifier}}
771 // [email protected]:* {{but in 'FirstModule' found public access specifier}}
772 #endif
773 
774 #if defined(FIRST) || defined(SECOND)
775 struct Valid2 {
776   virtual ~Valid2();
777 };
778 #else
779 Valid2 v2;
780 #endif
781 
782 #if defined(FIRST) || defined(SECOND)
783 struct Invalid2 {
784   virtual ~Invalid2();
785   ACCESS
786 };
787 #else
788 Invalid2 i2;
789 // [email protected]:* {{'Destructor::Invalid2' has different definitions in different modules; first difference is definition in module 'SecondModule' found private access specifier}}
790 // [email protected]:* {{but in 'FirstModule' found public access specifier}}
791 #endif
792 }  // namespace Destructor
793 
794 namespace TypeDef {
795 #if defined(FIRST)
796 struct S1 {
797   typedef int a;
798 };
799 #elif defined(SECOND)
800 struct S1 {
801   typedef double a;
802 };
803 #else
804 S1 s1;
805 // [email protected]:* {{'TypeDef::S1::a' from module 'FirstModule' is not present in definition of 'TypeDef::S1' in module 'SecondModule'}}
806 // [email protected]:* {{declaration of 'a' does not match}}
807 #endif
808 
809 #if defined(FIRST)
810 struct S2 {
811   typedef int a;
812 };
813 #elif defined(SECOND)
814 struct S2 {
815   typedef int b;
816 };
817 #else
818 S2 s2;
819 // [email protected]:* {{'TypeDef::S2::a' from module 'FirstModule' is not present in definition of 'TypeDef::S2' in module 'SecondModule'}}
820 // [email protected]:* {{definition has no member 'a'}}
821 #endif
822 
823 #if defined(FIRST)
824 typedef int T;
825 struct S3 {
826   typedef T a;
827 };
828 #elif defined(SECOND)
829 typedef double T;
830 struct S3 {
831   typedef T a;
832 };
833 #else
834 S3 s3;
835 // [email protected]:* {{'TypeDef::S3::a' from module 'FirstModule' is not present in definition of 'TypeDef::S3' in module 'SecondModule'}}
836 // [email protected]:* {{declaration of 'a' does not match}}
837 #endif
838 
839 #if defined(FIRST)
840 struct S4 {
841   typedef int a;
842   typedef int b;
843 };
844 #elif defined(SECOND)
845 struct S4 {
846   typedef int b;
847   typedef int a;
848 };
849 #else
850 S4 s4;
851 // [email protected]:* {{'TypeDef::S4' has different definitions in different modules; first difference is definition in module 'SecondModule' found typedef name 'b'}}
852 // [email protected]:* {{but in 'FirstModule' found typedef name 'a'}}
853 #endif
854 
855 #if defined(FIRST)
856 struct S5 {
857   typedef int a;
858   typedef int b;
859   int x;
860 };
861 #elif defined(SECOND)
862 struct S5 {
863   int x;
864   typedef int b;
865   typedef int a;
866 };
867 #else
868 S5 s5;
869 // [email protected]:* {{'TypeDef::S5' has different definitions in different modules; first difference is definition in module 'SecondModule' found field}}
870 // [email protected]:* {{but in 'FirstModule' found typedef}}
871 #endif
872 
873 #if defined(FIRST)
874 typedef float F;
875 struct S6 {
876   typedef int a;
877   typedef F b;
878 };
879 #elif defined(SECOND)
880 struct S6 {
881   typedef int a;
882   typedef float b;
883 };
884 #else
885 S6 s6;
886 // [email protected]:* {{'TypeDef::S6' has different definitions in different modules; first difference is definition in module 'SecondModule' found typedef 'b' with underlying type 'float'}}
887 // [email protected]:* {{but in 'FirstModule' found typedef 'b' with different underlying type 'TypeDef::F' (aka 'float')}}
888 #endif
889 
890 #define DECLS       \
891   typedef int A;    \
892   typedef double B; \
893   typedef I C;
894 
895 #if defined(FIRST) || defined(SECOND)
896 typedef int I;
897 #endif
898 
899 #if defined(FIRST) || defined(SECOND)
900 struct Valid1 {
901   DECLS
902 };
903 #else
904 Valid1 v1;
905 #endif
906 
907 #if defined(FIRST) || defined(SECOND)
908 struct Invalid1 {
909   DECLS
910   ACCESS
911 };
912 #else
913 Invalid1 i1;
914 // [email protected]:* {{'TypeDef::Invalid1' has different definitions in different modules; first difference is definition in module 'SecondModule' found private access specifier}}
915 // [email protected]:* {{but in 'FirstModule' found public access specifier}}
916 #endif
917 #undef DECLS
918 }  // namespace TypeDef
919 
920 namespace Using {
921 #if defined(FIRST)
922 struct S1 {
923   using a = int;
924 };
925 #elif defined(SECOND)
926 struct S1 {
927   using a = double;
928 };
929 #else
930 S1 s1;
931 // [email protected]:* {{'Using::S1::a' from module 'FirstModule' is not present in definition of 'Using::S1' in module 'SecondModule'}}
932 // [email protected]:* {{declaration of 'a' does not match}}
933 #endif
934 
935 #if defined(FIRST)
936 struct S2 {
937   using a = int;
938 };
939 #elif defined(SECOND)
940 struct S2 {
941   using b = int;
942 };
943 #else
944 S2 s2;
945 // [email protected]:* {{'Using::S2::a' from module 'FirstModule' is not present in definition of 'Using::S2' in module 'SecondModule'}}
946 // [email protected]:* {{definition has no member 'a'}}
947 #endif
948 
949 #if defined(FIRST)
950 typedef int T;
951 struct S3 {
952   using a = T;
953 };
954 #elif defined(SECOND)
955 typedef double T;
956 struct S3 {
957   using a = T;
958 };
959 #else
960 S3 s3;
961 // [email protected]:* {{'Using::S3::a' from module 'FirstModule' is not present in definition of 'Using::S3' in module 'SecondModule'}}
962 // [email protected]:* {{declaration of 'a' does not match}}
963 #endif
964 
965 #if defined(FIRST)
966 struct S4 {
967   using a = int;
968   using b = int;
969 };
970 #elif defined(SECOND)
971 struct S4 {
972   using b = int;
973   using a = int;
974 };
975 #else
976 S4 s4;
977 // [email protected]:* {{'Using::S4' has different definitions in different modules; first difference is definition in module 'SecondModule' found type alias name 'b'}}
978 // [email protected]:* {{but in 'FirstModule' found type alias name 'a'}}
979 #endif
980 
981 #if defined(FIRST)
982 struct S5 {
983   using a = int;
984   using b = int;
985   int x;
986 };
987 #elif defined(SECOND)
988 struct S5 {
989   int x;
990   using b = int;
991   using a = int;
992 };
993 #else
994 S5 s5;
995 // [email protected]:* {{'Using::S5' has different definitions in different modules; first difference is definition in module 'SecondModule' found field}}
996 // [email protected]:* {{but in 'FirstModule' found type alias}}
997 #endif
998 
999 #if defined(FIRST)
1000 typedef float F;
1001 struct S6 {
1002   using a = int;
1003   using b = F;
1004 };
1005 #elif defined(SECOND)
1006 struct S6 {
1007   using a = int;
1008   using b = float;
1009 };
1010 #else
1011 S6 s6;
1012 // [email protected]:* {{'Using::S6' has different definitions in different modules; first difference is definition in module 'SecondModule' found type alias 'b' with underlying type 'float'}}
1013 // [email protected]:* {{but in 'FirstModule' found type alias 'b' with different underlying type 'Using::F' (aka 'float')}}
1014 #endif
1015 
1016 #if defined(FIRST) || defined(SECOND)
1017 using I = int;
1018 #endif
1019 
1020 #define DECLS       \
1021   using A = int;    \
1022   using B = double; \
1023   using C = I;
1024 
1025 #if defined(FIRST) || defined(SECOND)
1026 struct Valid1 {
1027   DECLS
1028 };
1029 #else
1030 Valid1 v1;
1031 #endif
1032 
1033 #if defined(FIRST) || defined(SECOND)
1034 struct Invalid1 {
1035   DECLS
1036   ACCESS
1037 };
1038 #else
1039 Invalid1 i1;
1040 // [email protected]:* {{'Using::Invalid1' has different definitions in different modules; first difference is definition in module 'SecondModule' found private access specifier}}
1041 // [email protected]:* {{but in 'FirstModule' found public access specifier}}
1042 #endif
1043 #undef DECLS
1044 }  // namespace Using
1045 
1046 namespace RecordType {
1047 #if defined(FIRST)
1048 struct B1 {};
1049 struct S1 {
1050   B1 x;
1051 };
1052 #elif defined(SECOND)
1053 struct A1 {};
1054 struct S1 {
1055   A1 x;
1056 };
1057 #else
1058 S1 s1;
1059 // [email protected]:* {{'RecordType::S1::x' from module 'FirstModule' is not present in definition of 'RecordType::S1' in module 'SecondModule'}}
1060 // [email protected]:* {{declaration of 'x' does not match}}
1061 #endif
1062 
1063 #define DECLS \
1064   Foo F;
1065 
1066 #if defined(FIRST) || defined(SECOND)
1067 struct Foo {};
1068 #endif
1069 
1070 #if defined(FIRST) || defined(SECOND)
1071 struct Valid1 {
1072   DECLS
1073 };
1074 #else
1075 Valid1 v1;
1076 #endif
1077 
1078 #if defined(FIRST) || defined(SECOND)
1079 struct Invalid1 {
1080   DECLS
1081   ACCESS
1082 };
1083 #else
1084 Invalid1 i1;
1085 // [email protected]:* {{'RecordType::Invalid1' has different definitions in different modules; first difference is definition in module 'SecondModule' found private access specifier}}
1086 // [email protected]:* {{but in 'FirstModule' found public access specifier}}
1087 #endif
1088 #undef DECLS
1089 }  // namespace RecordType
1090 
1091 namespace DependentType {
1092 #if defined(FIRST)
1093 template <class T>
1094 class S1 {
1095   typename T::typeA x;
1096 };
1097 #elif defined(SECOND)
1098 template <class T>
1099 class S1 {
1100   typename T::typeB x;
1101 };
1102 #else
1103 template<class T>
1104 using U1 = S1<T>;
1105 // [email protected]:* {{'DependentType::S1::x' from module 'FirstModule' is not present in definition of 'S1<T>' in module 'SecondModule'}}
1106 // [email protected]:* {{declaration of 'x' does not match}}
1107 #endif
1108 
1109 #define DECLS \
1110   typename T::typeA x;
1111 
1112 #if defined(FIRST) || defined(SECOND)
1113 template <class T>
1114 struct Valid1 {
1115   DECLS
1116 };
1117 #else
1118 template <class T>
1119 using V1 = Valid1<T>;
1120 #endif
1121 
1122 #if defined(FIRST) || defined(SECOND)
1123 template <class T>
1124 struct Invalid1 {
1125   DECLS
1126   ACCESS
1127 };
1128 #else
1129 template <class T>
1130 using I1 = Invalid1<T>;
1131 // [email protected]:* {{'DependentType::Invalid1' has different definitions in different modules; first difference is definition in module 'SecondModule' found private access specifier}}
1132 // [email protected]:* {{but in 'FirstModule' found public access specifier}}
1133 #endif
1134 #undef DECLS
1135 }  // namespace DependentType
1136 
1137 namespace ElaboratedType {
1138 #if defined(FIRST)
1139 namespace N1 { using type = double; }
1140 struct S1 {
1141   N1::type x;
1142 };
1143 #elif defined(SECOND)
1144 namespace N1 { using type = int; }
1145 struct S1 {
1146   N1::type x;
1147 };
1148 #else
1149 S1 s1;
1150 // [email protected]:* {{'ElaboratedType::S1::x' from module 'FirstModule' is not present in definition of 'ElaboratedType::S1' in module 'SecondModule'}}
1151 // [email protected]:* {{declaration of 'x' does not match}}
1152 #endif
1153 
1154 #define DECLS \
1155   NS::type x;
1156 
1157 #if defined(FIRST) || defined(SECOND)
1158 namespace NS { using type = float; }
1159 #endif
1160 
1161 #if defined(FIRST) || defined(SECOND)
1162 struct Valid1 {
1163   DECLS
1164 };
1165 #else
1166 Valid1 v1;
1167 #endif
1168 
1169 #if defined(FIRST) || defined(SECOND)
1170 struct Invalid1 {
1171   DECLS
1172   ACCESS
1173 };
1174 #else
1175 Invalid1 i1;
1176 // [email protected]:* {{'ElaboratedType::Invalid1' has different definitions in different modules; first difference is definition in module 'SecondModule' found private access specifier}}
1177 // [email protected]:* {{but in 'FirstModule' found public access specifier}}
1178 #endif
1179 #undef DECLS
1180 }  // namespace ElaboratedType
1181 
1182 namespace Enum {
1183 #if defined(FIRST)
1184 enum A1 {};
1185 struct S1 {
1186   A1 x;
1187 };
1188 #elif defined(SECOND)
1189 enum A2 {};
1190 struct S1 {
1191   A2 x;
1192 };
1193 #else
1194 S1 s1;
1195 // [email protected]:* {{'Enum::S1::x' from module 'FirstModule' is not present in definition of 'Enum::S1' in module 'SecondModule'}}
1196 // [email protected]:* {{declaration of 'x' does not match}}
1197 #endif
1198 
1199 #define DECLS \
1200   E e = E1;
1201 
1202 #if defined(FIRST) || defined(SECOND)
1203 enum E { E1, E2 };
1204 #endif
1205 
1206 #if defined(FIRST) || defined(SECOND)
1207 struct Valid1 {
1208   DECLS
1209 };
1210 #else
1211 Valid1 v1;
1212 #endif
1213 
1214 #if defined(FIRST) || defined(SECOND)
1215 struct Invalid1 {
1216   DECLS
1217   ACCESS
1218 };
1219 #else
1220 Invalid1 i1;
1221 // [email protected]:* {{'Enum::Invalid1' has different definitions in different modules; first difference is definition in module 'SecondModule' found private access specifier}}
1222 // [email protected]:* {{but in 'FirstModule' found public access specifier}}
1223 #endif
1224 #undef DECLS
1225 }
1226 
1227 namespace NestedNamespaceSpecifier {
1228 #if defined(FIRST)
1229 namespace LevelA1 {
1230 using Type = int;
1231 }
1232 
1233 struct S1 {
1234   LevelA1::Type x;
1235 };
1236 # elif defined(SECOND)
1237 namespace LevelB1 {
1238 namespace LevelC1 {
1239 using Type = int;
1240 }
1241 }
1242 
1243 struct S1 {
1244   LevelB1::LevelC1::Type x;
1245 };
1246 #else
1247 S1 s1;
1248 // [email protected]:* {{'NestedNamespaceSpecifier::S1' has different definitions in different modules; first difference is definition in module 'SecondModule' found field 'x' with type 'LevelB1::LevelC1::Type' (aka 'int')}}
1249 // [email protected]:* {{but in 'FirstModule' found field 'x' with type 'LevelA1::Type' (aka 'int')}}
1250 #endif
1251 
1252 #if defined(FIRST)
1253 namespace LevelA2 { using Type = int; }
1254 struct S2 {
1255   LevelA2::Type x;
1256 };
1257 # elif defined(SECOND)
1258 struct S2 {
1259   int x;
1260 };
1261 #else
1262 S2 s2;
1263 // [email protected]:* {{'NestedNamespaceSpecifier::S2' has different definitions in different modules; first difference is definition in module 'SecondModule' found field 'x' with type 'int'}}
1264 // [email protected]:* {{but in 'FirstModule' found field 'x' with type 'LevelA2::Type' (aka 'int')}}
1265 #endif
1266 
1267 namespace LevelA3 { using Type = int; }
1268 namespace LevelB3 { using Type = int; }
1269 #if defined(FIRST)
1270 struct S3 {
1271   LevelA3::Type x;
1272 };
1273 # elif defined(SECOND)
1274 struct S3 {
1275   LevelB3::Type x;
1276 };
1277 #else
1278 S3 s3;
1279 // [email protected]:* {{'NestedNamespaceSpecifier::S3' has different definitions in different modules; first difference is definition in module 'SecondModule' found field 'x' with type 'LevelB3::Type' (aka 'int')}}
1280 // [email protected]:* {{but in 'FirstModule' found field 'x' with type 'LevelA3::Type' (aka 'int')}}
1281 #endif
1282 
1283 #if defined(FIRST)
1284 struct TA4 { using Type = int; };
1285 struct S4 {
1286   TA4::Type x;
1287 };
1288 # elif defined(SECOND)
1289 struct TB4 { using Type = int; };
1290 struct S4 {
1291   TB4::Type x;
1292 };
1293 #else
1294 S4 s4;
1295 // [email protected]:* {{'NestedNamespaceSpecifier::S4' has different definitions in different modules; first difference is definition in module 'SecondModule' found field 'x' with type 'TB4::Type' (aka 'int')}}
1296 // [email protected]:* {{but in 'FirstModule' found field 'x' with type 'TA4::Type' (aka 'int')}}
1297 #endif
1298 
1299 #if defined(FIRST)
1300 struct T5 { using Type = int; };
1301 struct S5 {
1302   T5::Type x;
1303 };
1304 # elif defined(SECOND)
1305 namespace T5 { using Type = int; };
1306 struct S5 {
1307   T5::Type x;
1308 };
1309 #else
1310 S5 s5;
1311 // [email protected]:* {{'NestedNamespaceSpecifier::S5' has different definitions in different modules; first difference is definition in module 'SecondModule' found field 'x' with type 'T5::Type' (aka 'int')}}
1312 // [email protected]:* {{but in 'FirstModule' found field 'x' with type 'T5::Type' (aka 'int')}}
1313 #endif
1314 
1315 #if defined(FIRST)
1316 namespace N6 {using I = int;}
1317 struct S6 {
1318   NestedNamespaceSpecifier::N6::I x;
1319 };
1320 # elif defined(SECOND)
1321 using I = int;
1322 struct S6 {
1323   ::NestedNamespaceSpecifier::I x;
1324 };
1325 #else
1326 S6 s6;
1327 // [email protected]:* {{'NestedNamespaceSpecifier::S6' has different definitions in different modules; first difference is definition in module 'SecondModule' found field 'x' with type '::NestedNamespaceSpecifier::I' (aka 'int')}}
1328 // [email protected]:* {{but in 'FirstModule' found field 'x' with type 'NestedNamespaceSpecifier::N6::I' (aka 'int')}}
1329 #endif
1330 
1331 #if defined(FIRST)
1332 template <class T, class U>
1333 class S7 {
1334   typename T::type *x = {};
1335   int z = x->T::foo();
1336 };
1337 #elif defined(SECOND)
1338 template <class T, class U>
1339 class S7 {
1340   typename T::type *x = {};
1341   int z = x->U::foo();
1342 };
1343 #else
1344 template <class T, class U>
1345 using U7 = S7<T, U>;
1346 // [email protected]:* {{'NestedNamespaceSpecifier::S7' has different definitions in different modules; first difference is definition in module 'SecondModule' found field 'z' with an initializer}}
1347 // [email protected]:* {{but in 'FirstModule' found field 'z' with a different initializer}}
1348 #endif
1349 
1350 #if defined(FIRST)
1351 template <class T>
1352 class S8 {
1353   int x = T::template X<int>::value;
1354 };
1355 #elif defined(SECOND)
1356 template <class T>
1357 class S8 {
1358   int x = T::template Y<int>::value;
1359 };
1360 #else
1361 template <class T>
1362 using U8 = S8<T>;
1363 // [email protected]:* {{'NestedNamespaceSpecifier::S8' has different definitions in different modules; first difference is definition in module 'SecondModule' found field 'x' with an initializer}}
1364 // [email protected]:* {{but in 'FirstModule' found field 'x' with a different initializer}}
1365 #endif
1366 
1367 #if defined(FIRST)
1368 namespace N9 { using I = int; }
1369 namespace O9 = N9;
1370 struct S9 {
1371   O9::I x;
1372 };
1373 #elif defined(SECOND)
1374 namespace N9 { using I = int; }
1375 namespace P9 = N9;
1376 struct S9 {
1377   P9::I x;
1378 };
1379 #else
1380 S9 s9;
1381 // [email protected]:* {{'NestedNamespaceSpecifier::S9' has different definitions in different modules; first difference is definition in module 'SecondModule' found field 'x' with type 'P9::I' (aka 'int')}}
1382 // [email protected]:* {{but in 'FirstModule' found field 'x' with type 'O9::I' (aka 'int')}}
1383 #endif
1384 
1385 namespace N10 {
1386 #if defined(FIRST)
1387 inline namespace A { struct X {}; }
1388 struct S10 {
1389   A::X x;
1390 };
1391 #elif defined(SECOND)
1392 inline namespace B { struct X {}; }
1393 struct S10 {
1394   B::X x;
1395 };
1396 #else
1397 S10 s10;
1398 // [email protected]:* {{'NestedNamespaceSpecifier::N10::S10::x' from module 'SecondModule' is not present in definition of 'NestedNamespaceSpecifier::N10::S10' in module 'FirstModule'}}
1399 // [email protected]:* {{declaration of 'x' does not match}}
1400 #endif
1401 }
1402 
1403 #define DECLS       \
1404   NS1::Type a;      \
1405   NS1::NS2::Type b; \
1406   NS1::S c;         \
1407   NS3::Type d;
1408 
1409 #if defined(FIRST) || defined(SECOND)
1410 namespace NS1 {
1411   using Type = int;
1412   namespace NS2 {
1413     using Type = double;
1414   }
1415   struct S {};
1416 }
1417 namespace NS3 = NS1;
1418 #endif
1419 
1420 #if defined(FIRST) || defined(SECOND)
1421 struct Valid1 {
1422   DECLS
1423 };
1424 #else
1425 Valid1 v1;
1426 #endif
1427 
1428 #if defined(FIRST) || defined(SECOND)
1429 struct Invalid1 {
1430   DECLS
1431   ACCESS
1432 };
1433 #else
1434 Invalid1 i1;
1435 // [email protected]:* {{'NestedNamespaceSpecifier::Invalid1' has different definitions in different modules; first difference is definition in module 'SecondModule' found private access specifier}}
1436 // [email protected]:* {{but in 'FirstModule' found public access specifier}}
1437 #endif
1438 #undef DECLS
1439 
1440 #define DECLS               \
1441   typename T::type *x = {}; \
1442   int y = x->T::foo();      \
1443   int z = U::template X<int>::value;
1444 
1445 #if defined(FIRST) || defined(SECOND)
1446 template <class T, class U>
1447 struct Valid2 {
1448   DECLS
1449 };
1450 #else
1451 template <class T, class U>
1452 using V2 = Valid2<T, U>;
1453 #endif
1454 
1455 #if defined(FIRST) || defined(SECOND)
1456 template <class T, class U>
1457 struct Invalid2 {
1458   DECLS
1459   ACCESS
1460 };
1461 #else
1462 template <class T, class U>
1463 using I2 = Invalid2<T, U>;
1464 // [email protected]:* {{'NestedNamespaceSpecifier::Invalid2' has different definitions in different modules; first difference is definition in module 'SecondModule' found private access specifier}}
1465 // [email protected]:* {{but in 'FirstModule' found public access specifier}}
1466 #endif
1467 #undef DECLS
1468 }  // namespace NestedNamespaceSpecifier
1469 
1470 namespace TemplateSpecializationType {
1471 #if defined(FIRST)
1472 template <class T1> struct U1 {};
1473 struct S1 {
1474   U1<int> u;
1475 };
1476 #elif defined(SECOND)
1477 template <class T1, class T2> struct U1 {};
1478 struct S1 {
1479   U1<int, int> u;
1480 };
1481 #else
1482 S1 s1;
1483 // [email protected]:* {{'TemplateSpecializationType::S1::u' from module 'FirstModule' is not present in definition of 'TemplateSpecializationType::S1' in module 'SecondModule'}}
1484 // [email protected]:* {{declaration of 'u' does not match}}
1485 #endif
1486 
1487 #if defined(FIRST)
1488 template <class T1> struct U2 {};
1489 struct S2 {
1490   U2<int> u;
1491 };
1492 #elif defined(SECOND)
1493 template <class T1> struct V1 {};
1494 struct S2 {
1495   V1<int> u;
1496 };
1497 #else
1498 S2 s2;
1499 // [email protected]:* {{'TemplateSpecializationType::S2::u' from module 'FirstModule' is not present in definition of 'TemplateSpecializationType::S2' in module 'SecondModule'}}
1500 // [email protected]:* {{declaration of 'u' does not match}}
1501 #endif
1502 
1503 #define DECLS                       \
1504   OneTemplateArg<int> x;            \
1505   OneTemplateArg<double> y;         \
1506   OneTemplateArg<char *> z;         \
1507   TwoTemplateArgs<int, int> a;      \
1508   TwoTemplateArgs<double, float> b; \
1509   TwoTemplateArgs<short *, char> c;
1510 
1511 #if defined(FIRST) || defined(SECOND)
1512 template <class T> struct OneTemplateArg {};
1513 template <class T, class U> struct TwoTemplateArgs {};
1514 #endif
1515 
1516 #if defined(FIRST) || defined(SECOND)
1517 struct Valid1 {
1518 DECLS
1519 };
1520 #else
1521 Valid1 v1;
1522 #endif
1523 
1524 #if defined(FIRST) || defined(SECOND)
1525 struct Invalid1 {
1526 DECLS
1527 ACCESS
1528 };
1529 #else
1530 Invalid1 i1;
1531 // [email protected]:* {{'TemplateSpecializationType::Invalid1' has different definitions in different modules; first difference is definition in module 'SecondModule' found private access specifier}}
1532 // [email protected]:* {{but in 'FirstModule' found public access specifier}}
1533 #endif
1534 #undef DECLS
1535 }  // namespace TemplateSpecializationType
1536 
1537 namespace TemplateArgument {
1538 #if defined(FIRST)
1539 template <class> struct U1{};
1540 struct S1 {
1541   U1<int> x;
1542 };
1543 #elif defined(SECOND)
1544 template <int> struct U1{};
1545 struct S1 {
1546   U1<1> x;
1547 };
1548 #else
1549 S1 s1;
1550 // [email protected]:* {{'TemplateArgument::S1::x' from module 'FirstModule' is not present in definition of 'TemplateArgument::S1' in module 'SecondModule'}}
1551 // [email protected]:* {{declaration of 'x' does not match}}
1552 #endif
1553 
1554 #if defined(FIRST)
1555 template <int> struct U2{};
1556 struct S2 {
1557   using T = U2<2>;
1558 };
1559 #elif defined(SECOND)
1560 template <int> struct U2{};
1561 struct S2 {
1562   using T = U2<(2)>;
1563 };
1564 #else
1565 S2 s2;
1566 // [email protected]:* {{'TemplateArgument::S2' has different definitions in different modules; first difference is definition in module 'SecondModule' found type alias 'T' with underlying type 'U2<(2)>'}}
1567 // [email protected]:* {{but in 'FirstModule' found type alias 'T' with different underlying type 'U2<2>'}}
1568 #endif
1569 
1570 #if defined(FIRST)
1571 template <int> struct U3{};
1572 struct S3 {
1573   using T = U3<2>;
1574 };
1575 #elif defined(SECOND)
1576 template <int> struct U3{};
1577 struct S3 {
1578   using T = U3<1 + 1>;
1579 };
1580 #else
1581 S3 s3;
1582 // [email protected]:* {{'TemplateArgument::S3' has different definitions in different modules; first difference is definition in module 'SecondModule' found type alias 'T' with underlying type 'U3<1 + 1>'}}
1583 // [email protected]:* {{but in 'FirstModule' found type alias 'T' with different underlying type 'U3<2>'}}
1584 #endif
1585 
1586 #if defined(FIRST)
1587 template<class> struct T4a {};
1588 template <template <class> class T> struct U4 {};
1589 struct S4 {
1590   U4<T4a> x;
1591 };
1592 #elif defined(SECOND)
1593 template<class> struct T4b {};
1594 template <template <class> class T> struct U4 {};
1595 struct S4 {
1596   U4<T4b> x;
1597 };
1598 #else
1599 S4 s4;
1600 // [email protected]:* {{'TemplateArgument::S4::x' from module 'FirstModule' is not present in definition of 'TemplateArgument::S4' in module 'SecondModule'}}
1601 // [email protected]:* {{declaration of 'x' does not match}}
1602 #endif
1603 
1604 #if defined(FIRST)
1605 template <class T> struct U5 {};
1606 struct S5 {
1607   U5<int> x;
1608 };
1609 #elif defined(SECOND)
1610 template <class T> struct U5 {};
1611 struct S5 {
1612   U5<short> x;
1613 };
1614 #else
1615 S5 s5;
1616 // [email protected]:* {{'TemplateArgument::S5::x' from module 'FirstModule' is not present in definition of 'TemplateArgument::S5' in module 'SecondModule'}}
1617 // [email protected]:* {{declaration of 'x' does not match}}
1618 #endif
1619 
1620 #if defined(FIRST)
1621 template <class T> struct U6 {};
1622 struct S6 {
1623   U6<int> x;
1624   U6<short> y;
1625 };
1626 #elif defined(SECOND)
1627 template <class T> struct U6 {};
1628 struct S6 {
1629   U6<short> y;
1630   U6<int> x;
1631 };
1632 #else
1633 S6 s6;
1634 // [email protected]:* {{'TemplateArgument::S6' has different definitions in different modules; first difference is definition in module 'SecondModule' found field 'y'}}
1635 // [email protected]:* {{but in 'FirstModule' found field 'x'}}
1636 #endif
1637 
1638 #define DECLS                   \
1639   OneClass<int> a;              \
1640   OneInt<1> b;                  \
1641   using c = OneClass<float>;    \
1642   using d = OneInt<2>;          \
1643   using e = OneInt<2 + 2>;      \
1644   OneTemplateClass<OneClass> f; \
1645   OneTemplateInt<OneInt> g;
1646 
1647 #if defined(FIRST) || defined(SECOND)
1648 template <class> struct OneClass{};
1649 template <int> struct OneInt{};
1650 template <template <class> class> struct OneTemplateClass{};
1651 template <template <int> class> struct OneTemplateInt{};
1652 #endif
1653 
1654 #if defined(FIRST) || defined(SECOND)
1655 struct Valid1 {
1656 DECLS
1657 };
1658 #else
1659 Valid1 v1;
1660 #endif
1661 
1662 #if defined(FIRST) || defined(SECOND)
1663 struct Invalid1 {
1664 DECLS
1665 ACCESS
1666 };
1667 #else
1668 Invalid1 i1;
1669 // [email protected]:* {{'TemplateArgument::Invalid1' has different definitions in different modules; first difference is definition in module 'SecondModule' found private access specifier}}
1670 // [email protected]:* {{but in 'FirstModule' found public access specifier}}
1671 #endif
1672 #undef DECLS
1673 }  // namespace TemplateArgument
1674 
1675 namespace TemplateTypeParmType {
1676 #if defined(FIRST)
1677 template <class T1, class T2>
1678 struct S1 {
1679   T1 x;
1680 };
1681 #elif defined(SECOND)
1682 template <class T1, class T2>
1683 struct S1 {
1684   T2 x;
1685 };
1686 #else
1687 using TemplateTypeParmType::S1;
1688 // [email protected]:* {{'TemplateTypeParmType::S1::x' from module 'FirstModule' is not present in definition of 'S1<T1, T2>' in module 'SecondModule'}}
1689 // [email protected]:* {{declaration of 'x' does not match}}
1690 #endif
1691 
1692 #if defined(FIRST)
1693 template <int ...Ts>
1694 struct U2 {};
1695 template <int T, int U>
1696 class S2 {
1697   typedef U2<U, T> type;
1698   type x;
1699 };
1700 #elif defined(SECOND)
1701 template <int ...Ts>
1702 struct U2 {};
1703 template <int T, int U>
1704 class S2 {
1705   typedef U2<T, U> type;
1706   type x;
1707 };
1708 #else
1709 using TemplateTypeParmType::S2;
1710 // [email protected]:* {{'TemplateTypeParmType::S2::x' from module 'FirstModule' is not present in definition of 'S2<T, U>' in module 'SecondModule'}}
1711 // [email protected]:* {{declaration of 'x' does not match}}
1712 // [email protected]:* {{'TemplateTypeParmType::S2::type' from module 'FirstModule' is not present in definition of 'S2<T, U>' in module 'SecondModule'}}
1713 // [email protected]:* {{declaration of 'type' does not match}}
1714 #endif
1715 
1716 #define DECLS            \
1717   T t;                   \
1718   U u;                   \
1719   ParameterPack<T> a;    \
1720   ParameterPack<T, U> b; \
1721   ParameterPack<U> c;    \
1722   ParameterPack<U, T> d;
1723 
1724 #if defined(FIRST) || defined(SECOND)
1725 template <class ...Ts> struct ParameterPack {};
1726 #endif
1727 
1728 #if defined(FIRST) || defined(SECOND)
1729 template <class T, class U>
1730 struct Valid1 {
1731   DECLS
1732 };
1733 #else
1734 using TemplateTypeParmType::Valid1;
1735 #endif
1736 
1737 #if defined(FIRST) || defined(SECOND)
1738 template <class T, class U>
1739 struct Invalid1 {
1740   DECLS
1741   ACCESS
1742 };
1743 #else
1744 using TemplateTypeParmType::Invalid1;
1745 // [email protected]:* {{'TemplateTypeParmType::Invalid1' has different definitions in different modules; first difference is definition in module 'SecondModule' found private access specifier}}
1746 // [email protected]:* {{but in 'FirstModule' found public access specifier}}
1747 #endif
1748 #undef DECLS
1749 }  // namespace TemplateTypeParmType
1750 
1751 namespace VarDecl {
1752 #if defined(FIRST)
1753 struct S1 {
1754   static int x;
1755   static int y;
1756 };
1757 #elif defined(SECOND)
1758 struct S1 {
1759   static int y;
1760   static int x;
1761 };
1762 #else
1763 S1 s1;
1764 // [email protected]:* {{'VarDecl::S1' has different definitions in different modules; first difference is definition in module 'SecondModule' found data member with name 'y'}}
1765 // [email protected]:* {{but in 'FirstModule' found data member with name 'x'}}
1766 #endif
1767 
1768 #if defined(FIRST)
1769 struct S2 {
1770   static int x;
1771 };
1772 #elif defined(SECOND)
1773 using I = int;
1774 struct S2 {
1775   static I x;
1776 };
1777 #else
1778 S2 s2;
1779 // [email protected]:* {{'VarDecl::S2' has different definitions in different modules; first difference is definition in module 'SecondModule' found data member 'x' with type 'VarDecl::I' (aka 'int')}}
1780 // [email protected]:* {{but in 'FirstModule' found data member 'x' with different type 'int'}}
1781 #endif
1782 
1783 #if defined(FIRST)
1784 struct S3 {
1785   static const int x = 1;
1786 };
1787 #elif defined(SECOND)
1788 struct S3 {
1789   static const int x;
1790 };
1791 #else
1792 S3 s3;
1793 // [email protected]:* {{'VarDecl::S3' has different definitions in different modules; first difference is definition in module 'SecondModule' found data member 'x' with an initializer}}
1794 // [email protected]:* {{but in 'FirstModule' found data member 'x' without an initializer}}
1795 #endif
1796 
1797 #if defined(FIRST)
1798 struct S4 {
1799   static const int x = 1;
1800 };
1801 #elif defined(SECOND)
1802 struct S4 {
1803   static const int x = 2;
1804 };
1805 #else
1806 S4 s4;
1807 // [email protected]:* {{'VarDecl::S4' has different definitions in different modules; first difference is definition in module 'SecondModule' found data member 'x' with an initializer}}
1808 // [email protected]:* {{but in 'FirstModule' found data member 'x' with a different initializer}}
1809 #endif
1810 
1811 #if defined(FIRST)
1812 struct S5 {
1813   static const int x = 1;
1814 };
1815 #elif defined(SECOND)
1816 struct S5 {
1817   static constexpr int x = 1;
1818 };
1819 #else
1820 S5 s5;
1821 // [email protected]:* {{'VarDecl::S5' has different definitions in different modules; first difference is definition in module 'SecondModule' found data member 'x' is not constexpr}}
1822 // [email protected]:* {{but in 'FirstModule' found data member 'x' is constexpr}}
1823 #endif
1824 
1825 #if defined(FIRST)
1826 struct S6 {
1827   static const int x = 1;
1828 };
1829 #elif defined(SECOND)
1830 struct S6 {
1831   static const int y = 1;
1832 };
1833 #else
1834 S6 s6;
1835 // [email protected]:* {{'VarDecl::S6::x' from module 'FirstModule' is not present in definition of 'VarDecl::S6' in module 'SecondModule'}}
1836 // [email protected]:* {{definition has no member 'x'}}
1837 #endif
1838 
1839 #if defined(FIRST)
1840 struct S7 {
1841   static const int x = 1;
1842 };
1843 #elif defined(SECOND)
1844 struct S7 {
1845   static const unsigned x = 1;
1846 };
1847 #else
1848 S7 s7;
1849 // [email protected]:* {{'VarDecl::S7::x' from module 'FirstModule' is not present in definition of 'VarDecl::S7' in module 'SecondModule'}}
1850 // [email protected]:* {{declaration of 'x' does not match}}
1851 #endif
1852 
1853 #if defined(FIRST)
1854 struct S8 {
1855 public:
1856   static const int x = 1;
1857 };
1858 #elif defined(SECOND)
1859 struct S8 {
1860   static const int x = 1;
1861 public:
1862 };
1863 #else
1864 S8 s8;
1865 // [email protected]:* {{'VarDecl::S8' has different definitions in different modules; first difference is definition in module 'SecondModule' found data member}}
1866 // [email protected]:* {{but in 'FirstModule' found public access specifier}}
1867 #endif
1868 
1869 #if defined(FIRST)
1870 struct S9 {
1871   static const int x = 1;
1872 };
1873 #elif defined(SECOND)
1874 struct S9 {
1875   static int x;
1876 };
1877 #else
1878 S9 s9;
1879 // [email protected]:* {{'VarDecl::S9::x' from module 'FirstModule' is not present in definition of 'VarDecl::S9' in module 'SecondModule'}}
1880 // [email protected]:* {{declaration of 'x' does not match}}
1881 #endif
1882 
1883 #define DECLS             \
1884   static int a;           \
1885   static I b;             \
1886   static const int c = 1; \
1887   static constexpr int d = 5;
1888 
1889 #if defined(FIRST) || defined(SECOND)
1890 using I = int;
1891 #endif
1892 
1893 #if defined(FIRST) || defined(SECOND)
1894 struct Valid1 {
1895   DECLS
1896 };
1897 #else
1898 Valid1 v1;
1899 #endif
1900 
1901 #if defined(FIRST) || defined(SECOND)
1902 struct Invalid1 {
1903   DECLS
1904   ACCESS
1905 };
1906 #else
1907 Invalid1 i1;
1908 // [email protected]:* {{'VarDecl::Invalid1' has different definitions in different modules; first difference is definition in module 'SecondModule' found private access specifier}}
1909 // [email protected]:* {{but in 'FirstModule' found public access specifier}}
1910 #endif
1911 #undef DECLS
1912 }  // namespace VarDecl
1913 
1914 namespace Friend {
1915 #if defined(FIRST)
1916 struct T1 {};
1917 struct S1 {
1918   friend class T1;
1919 };
1920 #elif defined(SECOND)
1921 struct T1 {};
1922 struct S1 {
1923   friend T1;
1924 };
1925 #else
1926 S1 s1;
1927 // [email protected]:* {{'Friend::S1' has different definitions in different modules; first difference is definition in module 'SecondModule' found friend 'Friend::T1'}}
1928 // [email protected]:* {{but in 'FirstModule' found friend 'class T1'}}
1929 #endif
1930 
1931 #if defined(FIRST)
1932 struct T2 {};
1933 struct S2 {
1934   friend class T2;
1935 };
1936 #elif defined(SECOND)
1937 struct T2 {};
1938 struct S2 {
1939   friend struct T2;
1940 };
1941 #else
1942 S2 s2;
1943 // [email protected]:* {{'Friend::S2' has different definitions in different modules; first difference is definition in module 'SecondModule' found friend 'struct T2'}}
1944 // [email protected]:* {{but in 'FirstModule' found friend 'class T2'}}
1945 #endif
1946 
1947 #if defined(FIRST)
1948 struct T3 {};
1949 struct S3 {
1950   friend const T3;
1951 };
1952 #elif defined(SECOND)
1953 struct T3 {};
1954 struct S3 {
1955   friend T3;
1956 };
1957 #else
1958 S3 s3;
1959 // [email protected]:* {{'Friend::S3' has different definitions in different modules; first difference is definition in module 'SecondModule' found friend 'Friend::T3'}}
1960 // [email protected]:* {{but in 'FirstModule' found friend 'const Friend::T3'}}
1961 #endif
1962 
1963 #if defined(FIRST)
1964 struct T4 {};
1965 struct S4 {
1966   friend T4;
1967 };
1968 #elif defined(SECOND)
1969 struct S4 {
1970   friend void T4();
1971 };
1972 #else
1973 S4 s4;
1974 // [email protected]:* {{'Friend::S4' has different definitions in different modules; first difference is definition in module 'SecondModule' found friend function}}
1975 // [email protected]:* {{but in 'FirstModule' found friend class}}
1976 #endif
1977 
1978 #if defined(FIRST)
1979 struct S5 {
1980   friend void T5a();
1981 };
1982 #elif defined(SECOND)
1983 struct S5 {
1984   friend void T5b();
1985 };
1986 #else
1987 S5 s5;
1988 // [email protected]:* {{'Friend::S5' has different definitions in different modules; first difference is definition in module 'SecondModule' found friend function 'T5b'}}
1989 // [email protected]:* {{but in 'FirstModule' found friend function 'T5a'}}
1990 #endif
1991 
1992 #define DECLS            \
1993   friend class FriendA;  \
1994   friend struct FriendB; \
1995   friend FriendC;        \
1996   friend const FriendD;  \
1997   friend void Function();
1998 
1999 #if defined(FIRST) || defined(SECOND)
2000 class FriendA {};
2001 class FriendB {};
2002 class FriendC {};
2003 class FriendD {};
2004 #endif
2005 
2006 #if defined(FIRST) || defined(SECOND)
2007 struct Valid1 {
2008   DECLS
2009 };
2010 #else
2011 Valid1 v1;
2012 #endif
2013 
2014 #if defined(FIRST) || defined(SECOND)
2015 struct Invalid1 {
2016   DECLS
2017   ACCESS
2018 };
2019 #else
2020 Invalid1 i1;
2021 // [email protected]:* {{'Friend::Invalid1' has different definitions in different modules; first difference is definition in module 'SecondModule' found private access specifier}}
2022 // [email protected]:* {{but in 'FirstModule' found public access specifier}}
2023 #endif
2024 #undef DECLS
2025 }  // namespace Friend
2026 
2027 namespace TemplateParameters {
2028 #if defined(FIRST)
2029 template <class A>
2030 struct S1 {};
2031 #elif defined(SECOND)
2032 template <class B>
2033 struct S1 {};
2034 #else
2035 using TemplateParameters::S1;
2036 // [email protected]:* {{'TemplateParameters::S1' has different definitions in different modules; first difference is definition in module 'SecondModule' found template parameter 'B'}}
2037 // [email protected]:* {{but in 'FirstModule' found template parameter 'A'}}
2038 #endif
2039 
2040 #if defined(FIRST)
2041 template <class A = double>
2042 struct S2 {};
2043 #elif defined(SECOND)
2044 template <class A = int>
2045 struct S2 {};
2046 #else
2047 using TemplateParameters::S2;
2048 // [email protected]:* {{'TemplateParameters::S2' has different definitions in different modules; first difference is definition in module 'SecondModule' found template parameter with default argument}}
2049 // [email protected]:* {{but in 'FirstModule' found template parameter with different default argument}}
2050 #endif
2051 
2052 #if defined(FIRST)
2053 template <class A = int>
2054 struct S3 {};
2055 #elif defined(SECOND)
2056 template <class A>
2057 struct S3 {};
2058 #else
2059 using TemplateParameters::S3;
2060 // [email protected]:* {{'TemplateParameters::S3' has different definitions in different modules; first difference is definition in module 'SecondModule' found template parameter with no default argument}}
2061 // [email protected]:* {{but in 'FirstModule' found template parameter with default argument}}
2062 #endif
2063 
2064 #if defined(FIRST)
2065 template <int A>
2066 struct S4 {};
2067 #elif defined(SECOND)
2068 template <int A = 2>
2069 struct S4 {};
2070 #else
2071 using TemplateParameters::S4;
2072 // [email protected]:* {{'TemplateParameters::S4' has different definitions in different modules; first difference is definition in module 'SecondModule' found template parameter with default argument}}
2073 // [email protected]:* {{but in 'FirstModule' found template parameter with no default argument}}
2074 #endif
2075 
2076 #if defined(FIRST)
2077 template <int> class S5_first {};
2078 template <template<int> class A = S5_first>
2079 struct S5 {};
2080 #elif defined(SECOND)
2081 template <int> class S5_second {};
2082 template <template<int> class A = S5_second>
2083 struct S5 {};
2084 #else
2085 using TemplateParameters::S5;
2086 // [email protected]:* {{'TemplateParameters::S5' has different definitions in different modules; first difference is definition in module 'SecondModule' found template parameter with default argument}}
2087 // [email protected]:* {{but in 'FirstModule' found template parameter with different default argument}}
2088 #endif
2089 
2090 #if defined(FIRST)
2091 template <class A>
2092 struct S6 {};
2093 #elif defined(SECOND)
2094 template <class>
2095 struct S6 {};
2096 #else
2097 using TemplateParameters::S6;
2098 // [email protected]:* {{'TemplateParameters::S6' has different definitions in different modules; first difference is definition in module 'SecondModule' found unnamed template parameter}}
2099 // [email protected]:* {{but in 'FirstModule' found template parameter 'A'}}
2100 #endif
2101 
2102 #define DECLS
2103 
2104 #if defined(FIRST) || defined(SECOND)
2105 template <class> class DefaultArg;
2106 #endif
2107 
2108 #if defined(FIRST) || defined(SECOND)
2109 template <int, class, template <class> class,
2110           int A, class B, template <int> class C,
2111           int D = 1, class E = int, template <class F> class = DefaultArg>
2112 struct Valid1 {
2113   DECLS
2114 };
2115 #else
2116 using TemplateParameters::Valid1;
2117 #endif
2118 
2119 #if defined(FIRST) || defined(SECOND)
2120 template <int, class, template <class> class,
2121           int A, class B, template <int> class C,
2122           int D = 1, class E = int, template <class F> class = DefaultArg>
2123 struct Invalid1 {
2124   DECLS
2125   ACCESS
2126 };
2127 #else
2128 using TemplateParameters::Invalid1;
2129 // [email protected]:* {{'TemplateParameters::Invalid1' has different definitions in different modules; first difference is definition in module 'SecondModule' found private access specifier}}
2130 // [email protected]:* {{but in 'FirstModule' found public access specifier}}
2131 #endif
2132 #undef DECLS
2133 }  // namespace TemplateParameters
2134 
2135 namespace BaseClass {
2136 #if defined(FIRST)
2137 struct B1 {};
2138 struct S1 : B1 {};
2139 #elif defined(SECOND)
2140 struct S1 {};
2141 #else
2142 S1 s1;
2143 // [email protected]:* {{'BaseClass::S1' has different definitions in different modules; first difference is definition in module 'SecondModule' found 0 base classes}}
2144 // [email protected]:* {{but in 'FirstModule' found 1 base class}}
2145 #endif
2146 
2147 #if defined(FIRST)
2148 struct S2 {};
2149 #elif defined(SECOND)
2150 struct B2 {};
2151 struct S2 : virtual B2 {};
2152 #else
2153 S2 s2;
2154 // [email protected]:* {{'BaseClass::S2' has different definitions in different modules; first difference is definition in module 'SecondModule' found 1 base class}}
2155 // [email protected]:* {{but in 'FirstModule' found 0 base classes}}
2156 #endif
2157 
2158 #if defined(FIRST)
2159 struct B3a {};
2160 struct S3 : B3a {};
2161 #elif defined(SECOND)
2162 struct B3b {};
2163 struct S3 : virtual B3b {};
2164 #else
2165 S3 s3;
2166 // [email protected]:* {{'BaseClass::S3' has different definitions in different modules; first difference is definition in module 'SecondModule' found 1 virtual base class}}
2167 // [email protected]:* {{but in 'FirstModule' found 0 virtual base classes}}
2168 #endif
2169 
2170 #if defined(FIRST)
2171 struct B4a {};
2172 struct S4 : B4a {};
2173 #elif defined(SECOND)
2174 struct B4b {};
2175 struct S4 : B4b {};
2176 #else
2177 S4 s4;
2178 // [email protected]:* {{'BaseClass::S4' has different definitions in different modules; first difference is definition in module 'SecondModule' found 1st base class with type 'BaseClass::B4b'}}
2179 // [email protected]:* {{but in 'FirstModule' found 1st base class with different type 'BaseClass::B4a'}}
2180 #endif
2181 
2182 #if defined(FIRST)
2183 struct B5a {};
2184 struct S5 : virtual B5a {};
2185 #elif defined(SECOND)
2186 struct B5a {};
2187 struct S5 : B5a {};
2188 #else
2189 S5 s5;
2190 // [email protected]:* {{'BaseClass::S5' has different definitions in different modules; first difference is definition in module 'SecondModule' found 0 virtual base classes}}
2191 // [email protected]:* {{but in 'FirstModule' found 1 virtual base class}}
2192 #endif
2193 
2194 #if defined(FIRST)
2195 struct B6a {};
2196 struct S6 : B6a {};
2197 #elif defined(SECOND)
2198 struct B6a {};
2199 struct S6 : virtual B6a {};
2200 #else
2201 S6 s6;
2202 // [email protected]:* {{'BaseClass::S6' has different definitions in different modules; first difference is definition in module 'SecondModule' found 1 virtual base class}}
2203 // [email protected]:* {{but in 'FirstModule' found 0 virtual base classes}}
2204 #endif
2205 
2206 #if defined(FIRST)
2207 struct B7a {};
2208 struct S7 : protected B7a {};
2209 #elif defined(SECOND)
2210 struct B7a {};
2211 struct S7 : B7a {};
2212 #else
2213 S7 s7;
2214 // [email protected]:* {{'BaseClass::S7' has different definitions in different modules; first difference is definition in module 'SecondModule' found 1st base class 'BaseClass::B7a' with no access specifier}}
2215 // [email protected]:* {{but in 'FirstModule' found 1st base class 'BaseClass::B7a' with protected access specifier}}
2216 #endif
2217 
2218 #if defined(FIRST)
2219 struct B8a {};
2220 struct S8 : public B8a {};
2221 #elif defined(SECOND)
2222 struct B8a {};
2223 struct S8 : private B8a {};
2224 #else
2225 S8 s8;
2226 // [email protected]:* {{'BaseClass::S8' has different definitions in different modules; first difference is definition in module 'SecondModule' found 1st base class 'BaseClass::B8a' with private access specifier}}
2227 // [email protected]:* {{but in 'FirstModule' found 1st base class 'BaseClass::B8a' with public access specifier}}
2228 #endif
2229 
2230 #if defined(FIRST)
2231 struct B9a {};
2232 struct S9 : private B9a {};
2233 #elif defined(SECOND)
2234 struct B9a {};
2235 struct S9 : public B9a {};
2236 #else
2237 S9 s9;
2238 // [email protected]:* {{'BaseClass::S9' has different definitions in different modules; first difference is definition in module 'SecondModule' found 1st base class 'BaseClass::B9a' with public access specifier}}
2239 // [email protected]:* {{but in 'FirstModule' found 1st base class 'BaseClass::B9a' with private access specifier}}
2240 #endif
2241 
2242 #if defined(FIRST)
2243 struct B10a {};
2244 struct S10 : B10a {};
2245 #elif defined(SECOND)
2246 struct B10a {};
2247 struct S10 : protected B10a {};
2248 #else
2249 S10 s10;
2250 // [email protected]:* {{'BaseClass::S10' has different definitions in different modules; first difference is definition in module 'SecondModule' found 1st base class 'BaseClass::B10a' with protected access specifier}}
2251 // [email protected]:* {{but in 'FirstModule' found 1st base class 'BaseClass::B10a' with no access specifier}}
2252 #endif
2253 
2254 #define DECLS
2255 
2256 #if defined(FIRST) || defined(SECOND)
2257 struct Base1 {};
2258 struct Base2 {};
2259 struct Base3 {};
2260 struct Base4 {};
2261 struct Base5 {};
2262 #endif
2263 
2264 #if defined(FIRST) || defined(SECOND)
2265 struct Valid1 :
2266   Base1, virtual Base2, protected Base3, public Base4, private Base5 {
2267 
2268   DECLS
2269 };
2270 #else
2271 Valid1 v1;
2272 #endif
2273 
2274 #if defined(FIRST) || defined(SECOND)
2275 struct Invalid1 :
2276   Base1, virtual Base2, protected Base3, public Base4, private Base5 {
2277 
2278   DECLS
2279   ACCESS
2280 };
2281 #else
2282 Invalid1 i1;
2283 // [email protected]:* {{'BaseClass::Invalid1' has different definitions in different modules; first difference is definition in module 'SecondModule' found private access specifier}}
2284 // [email protected]:* {{but in 'FirstModule' found public access specifier}}
2285 #endif
2286 #undef DECLS
2287 }  // namespace BaseClass
2288 
2289 namespace PointersAndReferences {
2290 #if defined(FIRST) || defined(SECOND)
2291 template<typename> struct Wrapper{};
2292 #endif
2293 
2294 #if defined(FIRST)
2295 struct S1 {
2296   Wrapper<int*> x;
2297 };
2298 #elif defined(SECOND)
2299 struct S1 {
2300   Wrapper<float*> x;
2301 };
2302 #else
2303 S1 s1;
2304 // [email protected]:* {{PointersAndReferences::S1::x' from module 'FirstModule' is not present in definition of 'PointersAndReferences::S1' in module 'SecondModule'}}
2305 // [email protected]:* {{declaration of 'x' does not match}}
2306 #endif
2307 
2308 #if defined(FIRST)
2309 struct S2 {
2310   Wrapper<int &&> x;
2311 };
2312 #elif defined(SECOND)
2313 struct S2 {
2314   Wrapper<float &&> x;
2315 };
2316 #else
2317 S2 s2;
2318 // [email protected]:* {{PointersAndReferences::S2::x' from module 'FirstModule' is not present in definition of 'PointersAndReferences::S2' in module 'SecondModule'}}
2319 // [email protected]:* {{declaration of 'x' does not match}}
2320 #endif
2321 
2322 #if defined(FIRST)
2323 struct S3 {
2324   Wrapper<int *> x;
2325 };
2326 #elif defined(SECOND)
2327 struct S3 {
2328   Wrapper<float *> x;
2329 };
2330 #else
2331 S3 s3;
2332 // [email protected]:* {{PointersAndReferences::S3::x' from module 'FirstModule' is not present in definition of 'PointersAndReferences::S3' in module 'SecondModule'}}
2333 // [email protected]:* {{declaration of 'x' does not match}}
2334 #endif
2335 
2336 #if defined(FIRST)
2337 struct S4 {
2338   Wrapper<int &> x;
2339 };
2340 #elif defined(SECOND)
2341 struct S4 {
2342   Wrapper<float &> x;
2343 };
2344 #else
2345 S4 s4;
2346 // [email protected]:* {{PointersAndReferences::S4::x' from module 'FirstModule' is not present in definition of 'PointersAndReferences::S4' in module 'SecondModule'}}
2347 // [email protected]:* {{declaration of 'x' does not match}}
2348 #endif
2349 
2350 #if defined(FIRST)
2351 struct S5 {
2352   Wrapper<S5 *> x;
2353 };
2354 #elif defined(SECOND)
2355 struct S5 {
2356   Wrapper<const S5 *> x;
2357 };
2358 #else
2359 S5 s5;
2360 // [email protected]:* {{'PointersAndReferences::S5::x' from module 'SecondModule' is not present in definition of 'PointersAndReferences::S5' in module 'FirstModule'}}
2361 // [email protected]:* {{declaration of 'x' does not match}}
2362 #endif
2363 
2364 #if defined(FIRST)
2365 struct S6 {
2366   Wrapper<int &> x;
2367 };
2368 #elif defined(SECOND)
2369 struct S6 {
2370   Wrapper<const int &> x;
2371 };
2372 #else
2373 S6 s6;
2374 // [email protected]:* {{PointersAndReferences::S6::x' from module 'FirstModule' is not present in definition of 'PointersAndReferences::S6' in module 'SecondModule'}}
2375 // [email protected]:* {{declaration of 'x' does not match}}
2376 #endif
2377 
2378 #define DECLS                \
2379   Wrapper<int *> x1;         \
2380   Wrapper<float *> x2;       \
2381   Wrapper<const float *> x3; \
2382   Wrapper<int &> x4;         \
2383   Wrapper<int &&> x5;        \
2384   Wrapper<const int &> x6;   \
2385   Wrapper<S1 *> x7;          \
2386   Wrapper<S1 &> x8;          \
2387   Wrapper<S1 &&> x9;
2388 
2389 #if defined(FIRST) || defined(SECOND)
2390 struct Valid1 {
2391   DECLS
2392 };
2393 #else
2394 Valid1 v1;
2395 #endif
2396 
2397 #if defined(FIRST) || defined(SECOND)
2398 struct Invalid1 {
2399   DECLS
2400   ACCESS
2401 };
2402 #else
2403 Invalid1 i1;
2404 // [email protected]:* {{'PointersAndReferences::Invalid1' has different definitions in different modules; first difference is definition in module 'SecondModule' found private access specifier}}
2405 // [email protected]:* {{but in 'FirstModule' found public access specifier}}
2406 #endif
2407 #undef DECLS
2408 }  // namespace PointersAndReferences
2409 
2410 
2411 // Collection of interesting cases below.
2412 
2413 // Naive parsing of AST can lead to cycles in processing.  Ensure
2414 // self-references don't trigger an endless cycles of AST node processing.
2415 namespace SelfReference {
2416 #if defined(FIRST)
2417 template <template <int> class T> class Wrapper {};
2418 
2419 template <int N> class S {
2420   S(Wrapper<::SelfReference::S> &Ref) {}
2421 };
2422 
2423 struct Xx {
2424   struct Yy {
2425   };
2426 };
2427 
2428 Xx::Xx::Xx::Yy yy;
2429 
2430 namespace NNS {
2431 template <typename> struct Foo;
2432 template <template <class> class T = NNS::Foo>
2433 struct NestedNamespaceSpecifier {};
2434 }
2435 #endif
2436 }  // namespace SelfReference
2437 
2438 namespace FriendFunction {
2439 #if defined(FIRST)
2440 void F(int = 0);
2441 struct S { friend void F(int); };
2442 #elif defined(SECOND)
2443 void F(int);
2444 struct S { friend void F(int); };
2445 #else
2446 S s;
2447 #endif
2448 
2449 #if defined(FIRST)
2450 void G(int = 0);
2451 struct T {
2452   friend void G(int);
2453 
2454   private:
2455 };
2456 #elif defined(SECOND)
2457 void G(int);
2458 struct T {
2459   friend void G(int);
2460 
2461   public:
2462 };
2463 #else
2464 T t;
2465 // [email protected]:* {{'FriendFunction::T' has different definitions in different modules; first difference is definition in module 'SecondModule' found public access specifier}}
2466 // [email protected]:* {{but in 'FirstModule' found private access specifier}}
2467 #endif
2468 }  // namespace FriendFunction
2469 
2470 namespace ImplicitDecl {
2471 #if defined(FIRST)
2472 struct S { };
2473 void S_Constructors() {
2474   // Trigger creation of implicit contructors
2475   S foo;
2476   S bar = foo;
2477   S baz(bar);
2478 }
2479 #elif defined(SECOND)
2480 struct S { };
2481 #else
2482 S s;
2483 #endif
2484 
2485 #if defined(FIRST)
2486 struct T {
2487   private:
2488 };
2489 void T_Constructors() {
2490   // Trigger creation of implicit contructors
2491   T foo;
2492   T bar = foo;
2493   T baz(bar);
2494 }
2495 #elif defined(SECOND)
2496 struct T {
2497   public:
2498 };
2499 #else
2500 T t;
2501 // [email protected]:* {{'ImplicitDecl::T' has different definitions in different modules; first difference is definition in module 'FirstModule' found private access specifier}}
2502 // [email protected]:* {{but in 'SecondModule' found public access specifier}}
2503 #endif
2504 
2505 }  // namespace ImplicitDecl
2506 
2507 namespace TemplatedClass {
2508 #if defined(FIRST)
2509 template <class>
2510 struct S {};
2511 #elif defined(SECOND)
2512 template <class>
2513 struct S {};
2514 #else
2515 S<int> s;
2516 #endif
2517 
2518 #if defined(FIRST)
2519 template <class>
2520 struct T {
2521   private:
2522 };
2523 #elif defined(SECOND)
2524 template <class>
2525 struct T {
2526   public:
2527 };
2528 #else
2529 T<int> t;
2530 // [email protected]:* {{'TemplatedClass::T' has different definitions in different modules; first difference is definition in module 'SecondModule' found public access specifier}}
2531 // [email protected]:* {{but in 'FirstModule' found private access specifier}}
2532 #endif
2533 }  // namespace TemplatedClass
2534 
2535 namespace TemplateClassWithField {
2536 #if defined(FIRST)
2537 template <class A>
2538 struct S {
2539   A a;
2540 };
2541 #elif defined(SECOND)
2542 template <class A>
2543 struct S {
2544   A a;
2545 };
2546 #else
2547 S<int> s;
2548 #endif
2549 
2550 #if defined(FIRST)
2551 template <class A>
2552 struct T {
2553   A a;
2554 
2555   private:
2556 };
2557 #elif defined(SECOND)
2558 template <class A>
2559 struct T {
2560   A a;
2561 
2562   public:
2563 };
2564 #else
2565 T<int> t;
2566 // [email protected]:* {{'TemplateClassWithField::T' has different definitions in different modules; first difference is definition in module 'SecondModule' found public access specifier}}
2567 // [email protected]:* {{but in 'FirstModule' found private access specifier}}
2568 #endif
2569 }  // namespace TemplateClassWithField
2570 
2571 namespace TemplateClassWithTemplateField {
2572 #if defined(FIRST)
2573 template <class A>
2574 class WrapperS;
2575 template <class A>
2576 struct S {
2577   WrapperS<A> a;
2578 };
2579 #elif defined(SECOND)
2580 template <class A>
2581 class WrapperS;
2582 template <class A>
2583 struct S {
2584   WrapperS<A> a;
2585 };
2586 #else
2587 template <class A>
2588 class WrapperS{};
2589 S<int> s;
2590 #endif
2591 
2592 #if defined(FIRST)
2593 template <class A>
2594 class WrapperT;
2595 template <class A>
2596 struct T {
2597   WrapperT<A> a;
2598 
2599   public:
2600 };
2601 #elif defined(SECOND)
2602 template <class A>
2603 class WrapperT;
2604 template <class A>
2605 struct T {
2606   WrapperT<A> a;
2607 
2608   private:
2609 };
2610 #else
2611 template <class A>
2612 class WrapperT{};
2613 T<int> t;
2614 // [email protected]:* {{'TemplateClassWithTemplateField::T' has different definitions in different modules; first difference is definition in module 'SecondModule' found private access specifier}}
2615 // [email protected]:* {{but in 'FirstModule' found public access specifier}}
2616 #endif
2617 }  // namespace TemplateClassWithTemplateField
2618 
2619 namespace EnumWithForwardDeclaration {
2620 #if defined(FIRST)
2621 enum E : int;
2622 struct S {
2623   void get(E) {}
2624 };
2625 #elif defined(SECOND)
2626 enum E : int { A, B };
2627 struct S {
2628   void get(E) {}
2629 };
2630 #else
2631 S s;
2632 #endif
2633 
2634 #if defined(FIRST)
2635 struct T {
2636   void get(E) {}
2637   public:
2638 };
2639 #elif defined(SECOND)
2640 struct T {
2641   void get(E) {}
2642   private:
2643 };
2644 #else
2645 T t;
2646 // [email protected]:* {{'EnumWithForwardDeclaration::T' has different definitions in different modules; first difference is definition in module 'SecondModule' found private access specifier}}
2647 // [email protected]:* {{but in 'FirstModule' found public access specifier}}
2648 #endif
2649 }  // namespace EnumWithForwardDeclaration
2650 
2651 namespace StructWithForwardDeclaration {
2652 #if defined(FIRST)
2653 struct P {};
2654 struct S {
2655   struct P *ptr;
2656 };
2657 #elif defined(SECOND)
2658 struct S {
2659   struct P *ptr;
2660 };
2661 #else
2662 S s;
2663 #endif
2664 
2665 #if defined(FIRST)
2666 struct Q {};
2667 struct T {
2668   struct Q *ptr;
2669   public:
2670 };
2671 #elif defined(SECOND)
2672 struct T {
2673   struct Q *ptr;
2674   private:
2675 };
2676 #else
2677 T t;
2678 // [email protected]:* {{'StructWithForwardDeclaration::T' has different definitions in different modules; first difference is definition in module 'SecondModule' found private access specifier}}
2679 // [email protected]:* {{but in 'FirstModule' found public access specifier}}
2680 #endif
2681 }  // namespace StructWithForwardDeclaration
2682 
2683 namespace StructWithForwardDeclarationNoDefinition {
2684 #if defined(FIRST)
2685 struct P;
2686 struct S {
2687   struct P *ptr;
2688 };
2689 #elif defined(SECOND)
2690 struct S {
2691   struct P *ptr;
2692 };
2693 #else
2694 S s;
2695 #endif
2696 
2697 #if defined(FIRST)
2698 struct Q;
2699 struct T {
2700   struct Q *ptr;
2701 
2702   public:
2703 };
2704 #elif defined(SECOND)
2705 struct T {
2706   struct Q *ptr;
2707 
2708   private:
2709 };
2710 #else
2711 T t;
2712 // [email protected]:* {{'StructWithForwardDeclarationNoDefinition::T' has different definitions in different modules; first difference is definition in module 'SecondModule' found private access specifier}}
2713 // [email protected]:* {{but in 'FirstModule' found public access specifier}}
2714 #endif
2715 }  // namespace StructWithForwardDeclarationNoDefinition
2716 
2717 namespace LateParsedDefaultArgument {
2718 #if defined(FIRST)
2719 template <typename T>
2720 struct S {
2721   struct R {
2722     void foo(T x = 0) {}
2723   };
2724 };
2725 #elif defined(SECOND)
2726 #else
2727 void run() {
2728   S<int>::R().foo();
2729 }
2730 #endif
2731 }  // namespace LateParsedDefaultArgument
2732 
2733 namespace LateParsedDefaultArgument {
2734 #if defined(FIRST)
2735 template <typename alpha> struct Bravo {
2736   void charlie(bool delta = false) {}
2737 };
2738 typedef Bravo<char> echo;
2739 echo foxtrot;
2740 
2741 Bravo<char> golf;
2742 #elif defined(SECOND)
2743 #else
2744 #endif
2745 }  // LateParsedDefaultArgument
2746 
2747 namespace DifferentParameterNameInTemplate {
2748 #if defined(FIRST) || defined(SECOND)
2749 template <typename T>
2750 struct S {
2751   typedef T Type;
2752 
2753   static void Run(const Type *name_one);
2754 };
2755 
2756 template <typename T>
2757 void S<T>::Run(const T *name_two) {}
2758 
2759 template <typename T>
2760 struct Foo {
2761   ~Foo() { Handler::Run(nullptr); }
2762   Foo() {}
2763 
2764   class Handler : public S<T> {};
2765 
2766   void Get(typename Handler::Type *x = nullptr) {}
2767   void Add() { Handler::Run(nullptr); }
2768 };
2769 #endif
2770 
2771 #if defined(FIRST)
2772 struct Beta;
2773 
2774 struct Alpha {
2775   Alpha();
2776   void Go() { betas.Get(); }
2777   Foo<Beta> betas;
2778 };
2779 
2780 #elif defined(SECOND)
2781 struct Beta {};
2782 
2783 struct BetaHelper {
2784   void add_Beta() { betas.Add(); }
2785   Foo<Beta> betas;
2786 };
2787 
2788 #else
2789 Alpha::Alpha() {}
2790 #endif
2791 }  // DifferentParameterNameInTemplate
2792 
2793 namespace ParameterTest {
2794 #if defined(FIRST)
2795 class X {};
2796 template <typename G>
2797 class S {
2798   public:
2799    typedef G Type;
2800    static inline G *Foo(const G *a, int * = nullptr);
2801 };
2802 
2803 template<typename G>
2804 G* S<G>::Foo(const G* aaaa, int*) {}
2805 #elif defined(SECOND)
2806 template <typename G>
2807 class S {
2808   public:
2809    typedef G Type;
2810    static inline G *Foo(const G *a, int * = nullptr);
2811 };
2812 
2813 template<typename G>
2814 G* S<G>::Foo(const G* asdf, int*) {}
2815 #else
2816 S<X> s;
2817 #endif
2818 }  // ParameterTest
2819 
2820 namespace MultipleTypedefs {
2821 #if defined(FIRST)
2822 typedef int B1;
2823 typedef B1 A1;
2824 struct S1 {
2825   A1 x;
2826 };
2827 #elif defined(SECOND)
2828 typedef int A1;
2829 struct S1 {
2830   A1 x;
2831 };
2832 #else
2833 S1 s1;
2834 #endif
2835 
2836 #if defined(FIRST)
2837 struct T2 { int x; };
2838 typedef T2 B2;
2839 typedef B2 A2;
2840 struct S2 {
2841   T2 x;
2842 };
2843 #elif defined(SECOND)
2844 struct T2 { int x; };
2845 typedef T2 A2;
2846 struct S2 {
2847   T2 x;
2848 };
2849 #else
2850 S2 s2;
2851 #endif
2852 
2853 #if defined(FIRST)
2854 using A3 = const int;
2855 using B3 = volatile A3;
2856 struct S3 {
2857   B3 x = 1;
2858 };
2859 #elif defined(SECOND)
2860 using A3 = volatile const int;
2861 using B3 = A3;
2862 struct S3 {
2863   B3 x = 1;
2864 };
2865 #else
2866 S3 s3;
2867 #endif
2868 
2869 #if defined(FIRST)
2870 using A4 = int;
2871 using B4 = A4;
2872 struct S4 {
2873   B4 x;
2874 };
2875 #elif defined(SECOND)
2876 using A4 = int;
2877 using B4 = ::MultipleTypedefs::A4;
2878 struct S4 {
2879   B4 x;
2880 };
2881 #else
2882 S4 s4;
2883 #endif
2884 
2885 #if defined(FIRST)
2886 using A5 = int;
2887 using B5 = MultipleTypedefs::A5;
2888 struct S5 {
2889   B5 x;
2890 };
2891 #elif defined(SECOND)
2892 using A5 = int;
2893 using B5 = ::MultipleTypedefs::A5;
2894 struct S5 {
2895   B5 x;
2896 };
2897 #else
2898 S5 s5;
2899 #endif
2900 }  // MultipleTypedefs
2901 
2902 namespace DefaultArguments {
2903 #if defined(FIRST)
2904 template <typename T>
2905 struct S {
2906   struct R {
2907     void foo(T x = 0);
2908   };
2909 };
2910 #elif defined(SECOND)
2911 template <typename T>
2912 struct S {
2913   struct R {
2914     void foo(T x = 1);
2915   };
2916 };
2917 #else
2918 void run() {
2919   S<int>::R().foo();
2920 }
2921 // [email protected]:* {{'DefaultArguments::S::R' has different definitions in different modules; first difference is definition in module 'SecondModule' found method 'foo' with 1st parameter with a default argument}}
2922 // [email protected]:* {{but in 'FirstModule' found method 'foo' with 1st parameter with a different default argument}}
2923 #endif
2924 
2925 #if defined(FIRST)
2926 template <typename alpha> struct Bravo {
2927   void charlie(bool delta = false);
2928 };
2929 typedef Bravo<char> echo;
2930 echo foxtrot;
2931 #elif defined(SECOND)
2932 template <typename alpha> struct Bravo {
2933   void charlie(bool delta = (false));
2934 };
2935 typedef Bravo<char> echo;
2936 echo foxtrot;
2937 #else
2938 Bravo<char> golf;
2939 // [email protected]:* {{'DefaultArguments::Bravo' has different definitions in different modules; first difference is definition in module 'SecondModule' found method 'charlie' with 1st parameter with a default argument}}
2940 // [email protected]:* {{but in 'FirstModule' found method 'charlie' with 1st parameter with a different default argument}}
2941 #endif
2942 }  // namespace DefaultArguments
2943 
2944 namespace FunctionDecl {
2945 #if defined(FIRST)
2946 struct S1 {};
2947 S1 s1a;
2948 #elif defined(SECOND)
2949 struct S1 {};
2950 #else
2951 S1 s1;
2952 #endif
2953 
2954 #if defined(FIRST)
2955 struct S2 {
2956   S2() = default;
2957 };
2958 S2 s2a = S2();
2959 #elif defined(SECOND)
2960 struct S2 {
2961   S2() = default;
2962 };
2963 #else
2964 S2 s2;
2965 #endif
2966 
2967 #if defined(FIRST)
2968 struct S3 {
2969   S3() = delete;
2970 };
2971 S3* s3c;
2972 #elif defined(SECOND)
2973 struct S3 {
2974   S3() = delete;
2975 };
2976 #else
2977 S3* s3;
2978 #endif
2979 
2980 #if defined(FIRST) || defined(SECOND)
2981 int F1(int x, float y = 2.7) { return 1; }
2982 #else
2983 int I1 = F1(1);
2984 #endif
2985 
2986 #if defined(FIRST)
2987 int F2() { return 1; }
2988 #elif defined(SECOND)
2989 double F2() { return 1; }
2990 #else
2991 int I2 = F2();
2992 // expected-error@-1 {{call to 'F2' is ambiguous}}
2993 // [email protected]:* {{candidate function}}
2994 // [email protected]:* {{candidate function}}
2995 #endif
2996 
2997 #if defined(FIRST)
2998 int F3(float) { return 1; }
2999 #elif defined(SECOND)
3000 int F3(double) { return 1; }
3001 #else
3002 int I3 = F3(1);
3003 // expected-error@-1 {{call to 'F3' is ambiguous}}
3004 // [email protected]:* {{candidate function}}
3005 // [email protected]:* {{candidate function}}
3006 #endif
3007 
3008 #if defined(FIRST)
3009 int F4(int x) { return 1; }
3010 #elif defined(SECOND)
3011 int F4(int y) { return 1; }
3012 #else
3013 int I4 = F4(1);
3014 // [email protected]:* {{'FunctionDecl::F4' has different definitions in different modules; definition in module 'SecondModule' first difference is 1st parameter with name 'y'}}
3015 // [email protected]:* {{but in 'FirstModule' found 1st parameter with name 'x'}}
3016 #endif
3017 
3018 #if defined(FIRST)
3019 int F5(int x) { return 1; }
3020 #elif defined(SECOND)
3021 int F5(int x = 1) { return 1; }
3022 #else
3023 int I5 = F6(1);
3024 // [email protected]:* {{'FunctionDecl::F5' has different definitions in different modules; definition in module 'SecondModule' first difference is 1st parameter without a default argument}}
3025 // [email protected]:* {{but in 'FirstModule' found 1st parameter with a default argument}}
3026 #endif
3027 
3028 #if defined(FIRST)
3029 int F6(int x = 2) { return 1; }
3030 #elif defined(SECOND)
3031 int F6(int x = 1) { return 1; }
3032 #else
3033 int I6 = F6(1);
3034 // [email protected]:* {{'FunctionDecl::F6' has different definitions in different modules; definition in module 'SecondModule' first difference is 1st parameter with a default argument}}
3035 // [email protected]:* {{but in 'FirstModule' found 1st parameter with a different default argument}}
3036 #endif
3037 
3038 using I = int;
3039 #if defined(FIRST)
3040 I F7() { return 0; }
3041 #elif defined(SECOND)
3042 int F7() { return 0; }
3043 #else
3044 int I7 = F7();
3045 // [email protected]:* {{'FunctionDecl::F7' has different definitions in different modules; definition in module 'SecondModule' first difference is return type is 'int'}}
3046 // [email protected]:* {{but in 'FirstModule' found different return type 'FunctionDecl::I' (aka 'int')}}
3047 #endif
3048 
3049 #if defined(FIRST)
3050 int F8(int) { return 0; }
3051 #elif defined(SECOND)
3052 int F8(I) { return 0; }
3053 #else
3054 int I8 = F8(1);
3055 // [email protected]:* {{'FunctionDecl::F8' has different definitions in different modules; definition in module 'SecondModule' first difference is 1st parameter with type 'FunctionDecl::I' (aka 'int')}}
3056 // [email protected]:* {{but in 'FirstModule' found 1st parameter with type 'int'}}
3057 #endif
3058 
3059 #if defined(FIRST)
3060 int F9(int[1]) { return 0; }
3061 #elif defined(SECOND)
3062 int F9(int[2]) { return 0; }
3063 #else
3064 int I9 = F9(nullptr);
3065 // [email protected]:* {{'FunctionDecl::F9' has different definitions in different modules; definition in module 'SecondModule' first difference is 1st parameter with type 'int *' decayed from 'int [2]'}}
3066 // [email protected]:* {{but in 'FirstModule' found 1st parameter with type 'int *' decayed from 'int [1]'}}
3067 #endif
3068 
3069 #if defined(FIRST)
3070 int F10() { return 1; }
3071 #elif defined(SECOND)
3072 int F10() { return 2; }
3073 #else
3074 int I10 = F10();
3075 #endif
3076 // [email protected]:* {{'FunctionDecl::F10' has different definitions in different modules; definition in module 'SecondModule' first difference is function body}}
3077 // [email protected]:* {{but in 'FirstModule' found a different body}}
3078 }  // namespace FunctionDecl
3079 
3080 namespace DeclTemplateArguments {
3081 #if defined(FIRST)
3082 int foo() { return 1; }
3083 int bar() { return foo(); }
3084 #elif defined(SECOND)
3085 template <class T = int>
3086 int foo() { return 2; }
3087 int bar() { return foo<>(); }
3088 #else
3089 int num = bar();
3090 // [email protected]:* {{'DeclTemplateArguments::bar' has different definitions in different modules; definition in module 'SecondModule' first difference is function body}}
3091 // [email protected]:* {{but in 'FirstModule' found a different body}}
3092 #endif
3093 }
3094 
3095 // Keep macros contained to one file.
3096 #ifdef FIRST
3097 #undef FIRST
3098 #endif
3099 
3100 #ifdef SECOND
3101 #undef SECOND
3102 #endif
3103 
3104 #ifdef ACCESS
3105 #undef ACCESS
3106 #endif
3107