1 // Clear and create directories
5 // RUN: mkdir %t/Inputs
7 // Build first header file
8 // RUN: echo "#define FIRST" >> %t/Inputs/first.h
9 // RUN: cat %s >> %t/Inputs/first.h
11 // Build second header file
12 // RUN: echo "#define SECOND" >> %t/Inputs/second.h
13 // RUN: cat %s >> %t/Inputs/second.h
15 // Test that each header can compile
16 // RUN: %clang_cc1 -fsyntax-only -x c++ -std=gnu++11 %t/Inputs/first.h
17 // RUN: %clang_cc1 -fsyntax-only -x c++ -std=gnu++11 %t/Inputs/second.h
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
28 // RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/cache -x c++ -I%t/Inputs -verify %s -std=gnu++11
30 #if !defined(FIRST) && !defined(SECOND)
36 namespace TypeOfExpr
{
65 // expected-error@first.h:* {{'Types::TypeOfExpr::Invalid1' has different definitions in different modules; first difference is definition in module 'FirstModule' found field 'x' with type 'typeof (1 + 2)' (aka 'int')}}
66 // expected-note@second.h:* {{but in 'SecondModule' found field 'x' with type 'typeof (3)' (aka 'int')}}
68 // expected-error@second.h:* {{'Types::TypeOfExpr::Invalid2::x' from module 'SecondModule' is not present in definition of 'Types::TypeOfExpr::Invalid2' in module 'FirstModule'}}
69 // expected-note@first.h:* {{declaration of 'x' does not match}}
72 } // namespace TypeOfExpr
88 using T
= typeof(double);
105 using T
= typeof(double);
110 // expected-error@second.h:* {{'Types::TypeOf::Invalid1::x' from module 'SecondModule' is not present in definition of 'Types::TypeOf::Invalid1' in module 'FirstModule'}}
111 // expected-note@first.h:* {{declaration of 'x' does not match}}
113 // expected-error@first.h:* {{'Types::TypeOf::Invalid2' has different definitions in different modules; first difference is definition in module 'FirstModule' found field 'x' with type 'typeof(int)' (aka 'int')}}
114 // expected-note@second.h:* {{but in 'SecondModule' found field 'x' with type 'typeof(Types::TypeOf::I)' (aka 'int')}}
116 // expected-error@second.h:* {{'Types::TypeOf::Invalid3::x' from module 'SecondModule' is not present in definition of 'Types::TypeOf::Invalid3' in module 'FirstModule'}}
117 // expected-note@first.h:* {{declaration of 'x' does not match}}
120 } // namespace TypeOf
123 // Keep macros contained to one file.