Richard Trieu | e7f7ed2 | 2017-02-22 01:11:25 +0000 | [diff] [blame] | 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 | // Build module map file |
| 16 | // RUN: echo "module FirstModule {" >> %t/Inputs/module.map |
| 17 | // RUN: echo " header \"first.h\"" >> %t/Inputs/module.map |
| 18 | // RUN: echo "}" >> %t/Inputs/module.map |
| 19 | // RUN: echo "module SecondModule {" >> %t/Inputs/module.map |
| 20 | // RUN: echo " header \"second.h\"" >> %t/Inputs/module.map |
| 21 | // RUN: echo "}" >> %t/Inputs/module.map |
| 22 | |
| 23 | // Run test |
Richard Trieu | 639d7b6 | 2017-02-22 22:22:42 +0000 | [diff] [blame] | 24 | // RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/cache -x c++ -I%t/Inputs -verify %s -std=c++1z |
Richard Trieu | e7f7ed2 | 2017-02-22 01:11:25 +0000 | [diff] [blame] | 25 | |
| 26 | #if !defined(FIRST) && !defined(SECOND) |
| 27 | #include "first.h" |
| 28 | #include "second.h" |
| 29 | #endif |
| 30 | |
| 31 | namespace AccessSpecifiers { |
| 32 | #if defined(FIRST) |
| 33 | struct S1 { |
| 34 | }; |
| 35 | #elif defined(SECOND) |
| 36 | struct S1 { |
| 37 | private: |
| 38 | }; |
| 39 | #else |
| 40 | S1 s1; |
| 41 | // expected-error@second.h:* {{'AccessSpecifiers::S1' has different definitions in different modules; first difference is definition in module 'SecondModule' found private access specifier}} |
| 42 | // expected-note@first.h:* {{but in 'FirstModule' found end of class}} |
| 43 | #endif |
| 44 | |
| 45 | #if defined(FIRST) |
| 46 | struct S2 { |
| 47 | public: |
| 48 | }; |
| 49 | #elif defined(SECOND) |
| 50 | struct S2 { |
| 51 | protected: |
| 52 | }; |
| 53 | #else |
| 54 | S2 s2; |
| 55 | // expected-error@second.h:* {{'AccessSpecifiers::S2' has different definitions in different modules; first difference is definition in module 'SecondModule' found protected access specifier}} |
| 56 | // expected-note@first.h:* {{but in 'FirstModule' found public access specifier}} |
| 57 | #endif |
| 58 | } // namespace AccessSpecifiers |
| 59 | |
Richard Trieu | 639d7b6 | 2017-02-22 22:22:42 +0000 | [diff] [blame] | 60 | namespace StaticAssert { |
| 61 | #if defined(FIRST) |
| 62 | struct S1 { |
| 63 | static_assert(1 == 1, "First"); |
| 64 | }; |
| 65 | #elif defined(SECOND) |
| 66 | struct S1 { |
| 67 | static_assert(1 == 1, "Second"); |
| 68 | }; |
| 69 | #else |
| 70 | S1 s1; |
| 71 | // expected-error@second.h:* {{'StaticAssert::S1' has different definitions in different modules; first difference is definition in module 'SecondModule' found static assert with message}} |
| 72 | // expected-note@first.h:* {{but in 'FirstModule' found static assert with different message}} |
| 73 | #endif |
| 74 | |
| 75 | #if defined(FIRST) |
| 76 | struct S2 { |
| 77 | static_assert(2 == 2, "Message"); |
| 78 | }; |
| 79 | #elif defined(SECOND) |
| 80 | struct S2 { |
| 81 | static_assert(2 == 2); |
| 82 | }; |
| 83 | #else |
| 84 | S2 s2; |
| 85 | // expected-error@second.h:* {{'StaticAssert::S2' has different definitions in different modules; first difference is definition in module 'SecondModule' found static assert with no message}} |
| 86 | // expected-note@first.h:* {{but in 'FirstModule' found static assert with message}} |
| 87 | #endif |
| 88 | |
| 89 | #if defined(FIRST) |
| 90 | struct S3 { |
| 91 | static_assert(3 == 3, "Message"); |
| 92 | }; |
| 93 | #elif defined(SECOND) |
| 94 | struct S3 { |
| 95 | static_assert(3 != 4, "Message"); |
| 96 | }; |
| 97 | #else |
| 98 | S3 s3; |
| 99 | // expected-error@second.h:* {{'StaticAssert::S3' has different definitions in different modules; first difference is definition in module 'SecondModule' found static assert with condition}} |
| 100 | // expected-note@first.h:* {{but in 'FirstModule' found static assert with different condition}} |
| 101 | #endif |
| 102 | |
| 103 | #if defined(FIRST) |
| 104 | struct S4 { |
| 105 | static_assert(4 == 4, "Message"); |
| 106 | }; |
| 107 | #elif defined(SECOND) |
| 108 | struct S4 { |
| 109 | public: |
| 110 | }; |
| 111 | #else |
| 112 | S4 s4; |
| 113 | // expected-error@second.h:* {{'StaticAssert::S4' has different definitions in different modules; first difference is definition in module 'SecondModule' found public access specifier}} |
| 114 | // expected-note@first.h:* {{but in 'FirstModule' found static assert}} |
| 115 | #endif |
| 116 | } |
| 117 | |
Richard Trieu | d078609 | 2017-02-23 00:23:01 +0000 | [diff] [blame] | 118 | namespace Field { |
| 119 | #if defined(FIRST) |
| 120 | struct S1 { |
| 121 | int x; |
| 122 | private: |
| 123 | int y; |
| 124 | }; |
| 125 | #elif defined(SECOND) |
| 126 | struct S1 { |
| 127 | int x; |
| 128 | int y; |
| 129 | }; |
| 130 | #else |
| 131 | S1 s1; |
| 132 | // expected-error@second.h:* {{'Field::S1' has different definitions in different modules; first difference is definition in module 'SecondModule' found field}} |
| 133 | // expected-note@first.h:* {{but in 'FirstModule' found private access specifier}} |
| 134 | #endif |
| 135 | |
| 136 | #if defined(FIRST) |
| 137 | struct S2 { |
| 138 | int x; |
| 139 | int y; |
| 140 | }; |
| 141 | #elif defined(SECOND) |
| 142 | struct S2 { |
| 143 | int y; |
| 144 | int x; |
| 145 | }; |
| 146 | #else |
| 147 | S2 s2; |
| 148 | // expected-error@second.h:* {{'Field::S2' has different definitions in different modules; first difference is definition in module 'SecondModule' found field 'y'}} |
| 149 | // expected-note@first.h:* {{but in 'FirstModule' found field 'x'}} |
| 150 | #endif |
Richard Trieu | bcaaf96 | 2017-02-23 03:25:57 +0000 | [diff] [blame] | 151 | |
| 152 | #if defined(FIRST) |
| 153 | struct S3 { |
| 154 | double x; |
| 155 | }; |
| 156 | #elif defined(SECOND) |
| 157 | struct S3 { |
| 158 | int x; |
| 159 | }; |
| 160 | #else |
| 161 | S3 s3; |
| 162 | // expected-error@first.h:* {{'Field::S3::x' from module 'FirstModule' is not present in definition of 'Field::S3' in module 'SecondModule'}} |
| 163 | // expected-note@second.h:* {{declaration of 'x' does not match}} |
| 164 | #endif |
Richard Trieu | 8459ddf | 2017-02-24 02:59:12 +0000 | [diff] [blame] | 165 | |
| 166 | #if defined(FIRST) |
| 167 | typedef int A; |
| 168 | struct S4 { |
| 169 | A x; |
| 170 | }; |
| 171 | |
| 172 | struct S5 { |
| 173 | A x; |
| 174 | }; |
| 175 | #elif defined(SECOND) |
| 176 | typedef int B; |
| 177 | struct S4 { |
| 178 | B x; |
| 179 | }; |
| 180 | |
| 181 | struct S5 { |
| 182 | int x; |
| 183 | }; |
| 184 | #else |
| 185 | S4 s4; |
| 186 | // expected-error@second.h:* {{'Field::S4' has different definitions in different modules; first difference is definition in module 'SecondModule' found field 'x' with type 'B' (aka 'int')}} |
| 187 | // expected-note@first.h:* {{but in 'FirstModule' found field 'x' with type 'A' (aka 'int')}} |
| 188 | |
| 189 | S5 s5; |
| 190 | // expected-error@second.h:* {{'Field::S5' has different definitions in different modules; first difference is definition in module 'SecondModule' found field 'x' with type 'int'}} |
| 191 | // expected-note@first.h:* {{but in 'FirstModule' found field 'x' with type 'A' (aka 'int')}} |
| 192 | #endif |
| 193 | |
| 194 | |
Richard Trieu | d078609 | 2017-02-23 00:23:01 +0000 | [diff] [blame] | 195 | } // namespace Field |
| 196 | |
Richard Trieu | e7f7ed2 | 2017-02-22 01:11:25 +0000 | [diff] [blame] | 197 | // Naive parsing of AST can lead to cycles in processing. Ensure |
| 198 | // self-references don't trigger an endless cycles of AST node processing. |
| 199 | namespace SelfReference { |
| 200 | #if defined(FIRST) |
| 201 | template <template <int> class T> class Wrapper {}; |
| 202 | |
| 203 | template <int N> class S { |
| 204 | S(Wrapper<::SelfReference::S> &Ref) {} |
| 205 | }; |
| 206 | |
| 207 | struct Xx { |
| 208 | struct Yy { |
| 209 | }; |
| 210 | }; |
| 211 | |
| 212 | Xx::Xx::Xx::Yy yy; |
| 213 | |
| 214 | namespace NNS { |
| 215 | template <typename> struct Foo; |
| 216 | template <template <class> class T = NNS::Foo> |
| 217 | struct NestedNamespaceSpecifier {}; |
| 218 | } |
| 219 | #endif |
| 220 | } // namespace SelfReference |
| 221 | |
| 222 | // Interesting cases that should not cause errors. struct S should not error |
| 223 | // while struct T should error at the access specifier mismatch at the end. |
| 224 | namespace AllDecls { |
| 225 | #if defined(FIRST) |
Richard Trieu | 8459ddf | 2017-02-24 02:59:12 +0000 | [diff] [blame] | 226 | typedef int INT; |
Richard Trieu | e7f7ed2 | 2017-02-22 01:11:25 +0000 | [diff] [blame] | 227 | struct S { |
| 228 | public: |
| 229 | private: |
| 230 | protected: |
Richard Trieu | 639d7b6 | 2017-02-22 22:22:42 +0000 | [diff] [blame] | 231 | |
| 232 | static_assert(1 == 1, "Message"); |
| 233 | static_assert(2 == 2); |
Richard Trieu | d078609 | 2017-02-23 00:23:01 +0000 | [diff] [blame] | 234 | |
| 235 | int x; |
| 236 | double y; |
Richard Trieu | 8459ddf | 2017-02-24 02:59:12 +0000 | [diff] [blame] | 237 | |
| 238 | INT z; |
Richard Trieu | e7f7ed2 | 2017-02-22 01:11:25 +0000 | [diff] [blame] | 239 | }; |
| 240 | #elif defined(SECOND) |
Richard Trieu | 8459ddf | 2017-02-24 02:59:12 +0000 | [diff] [blame] | 241 | typedef int INT; |
Richard Trieu | e7f7ed2 | 2017-02-22 01:11:25 +0000 | [diff] [blame] | 242 | struct S { |
| 243 | public: |
| 244 | private: |
| 245 | protected: |
Richard Trieu | 639d7b6 | 2017-02-22 22:22:42 +0000 | [diff] [blame] | 246 | |
| 247 | static_assert(1 == 1, "Message"); |
| 248 | static_assert(2 == 2); |
Richard Trieu | d078609 | 2017-02-23 00:23:01 +0000 | [diff] [blame] | 249 | |
| 250 | int x; |
| 251 | double y; |
Richard Trieu | 8459ddf | 2017-02-24 02:59:12 +0000 | [diff] [blame] | 252 | |
| 253 | INT z; |
Richard Trieu | e7f7ed2 | 2017-02-22 01:11:25 +0000 | [diff] [blame] | 254 | }; |
| 255 | #else |
| 256 | S s; |
| 257 | #endif |
| 258 | |
| 259 | #if defined(FIRST) |
Richard Trieu | 8459ddf | 2017-02-24 02:59:12 +0000 | [diff] [blame] | 260 | typedef int INT; |
Richard Trieu | e7f7ed2 | 2017-02-22 01:11:25 +0000 | [diff] [blame] | 261 | struct T { |
| 262 | public: |
| 263 | private: |
| 264 | protected: |
| 265 | |
Richard Trieu | 639d7b6 | 2017-02-22 22:22:42 +0000 | [diff] [blame] | 266 | static_assert(1 == 1, "Message"); |
| 267 | static_assert(2 == 2); |
| 268 | |
Richard Trieu | d078609 | 2017-02-23 00:23:01 +0000 | [diff] [blame] | 269 | int x; |
| 270 | double y; |
| 271 | |
Richard Trieu | 8459ddf | 2017-02-24 02:59:12 +0000 | [diff] [blame] | 272 | INT z; |
| 273 | |
Richard Trieu | e7f7ed2 | 2017-02-22 01:11:25 +0000 | [diff] [blame] | 274 | private: |
| 275 | }; |
| 276 | #elif defined(SECOND) |
Richard Trieu | 8459ddf | 2017-02-24 02:59:12 +0000 | [diff] [blame] | 277 | typedef int INT; |
Richard Trieu | e7f7ed2 | 2017-02-22 01:11:25 +0000 | [diff] [blame] | 278 | struct T { |
| 279 | public: |
| 280 | private: |
| 281 | protected: |
| 282 | |
Richard Trieu | 639d7b6 | 2017-02-22 22:22:42 +0000 | [diff] [blame] | 283 | static_assert(1 == 1, "Message"); |
| 284 | static_assert(2 == 2); |
| 285 | |
Richard Trieu | d078609 | 2017-02-23 00:23:01 +0000 | [diff] [blame] | 286 | int x; |
| 287 | double y; |
| 288 | |
Richard Trieu | 8459ddf | 2017-02-24 02:59:12 +0000 | [diff] [blame] | 289 | INT z; |
| 290 | |
Richard Trieu | e7f7ed2 | 2017-02-22 01:11:25 +0000 | [diff] [blame] | 291 | public: |
| 292 | }; |
| 293 | #else |
| 294 | T t; |
| 295 | // expected-error@second.h:* {{'AllDecls::T' has different definitions in different modules; first difference is definition in module 'SecondModule' found public access specifier}} |
| 296 | // expected-note@first.h:* {{but in 'FirstModule' found private access specifier}} |
| 297 | #endif |
| 298 | } |
| 299 | |
| 300 | namespace FriendFunction { |
| 301 | #if defined(FIRST) |
| 302 | void F(int = 0); |
| 303 | struct S { friend void F(int); }; |
| 304 | #elif defined(SECOND) |
| 305 | void F(int); |
| 306 | struct S { friend void F(int); }; |
| 307 | #else |
| 308 | S s; |
| 309 | #endif |
| 310 | |
| 311 | #if defined(FIRST) |
| 312 | void G(int = 0); |
| 313 | struct T { |
| 314 | friend void G(int); |
| 315 | |
| 316 | private: |
| 317 | }; |
| 318 | #elif defined(SECOND) |
| 319 | void G(int); |
| 320 | struct T { |
| 321 | friend void G(int); |
| 322 | |
| 323 | public: |
| 324 | }; |
| 325 | #else |
| 326 | T t; |
| 327 | // expected-error@second.h:* {{'FriendFunction::T' has different definitions in different modules; first difference is definition in module 'SecondModule' found public access specifier}} |
| 328 | // expected-note@first.h:* {{but in 'FirstModule' found private access specifier}} |
| 329 | #endif |
| 330 | } // namespace FriendFunction |
| 331 | |
| 332 | namespace ImplicitDecl { |
| 333 | #if defined(FIRST) |
| 334 | struct S { }; |
| 335 | void S_Constructors() { |
| 336 | // Trigger creation of implicit contructors |
| 337 | S foo; |
| 338 | S bar = foo; |
| 339 | S baz(bar); |
| 340 | } |
| 341 | #elif defined(SECOND) |
| 342 | struct S { }; |
| 343 | #else |
| 344 | S s; |
| 345 | #endif |
| 346 | |
| 347 | #if defined(FIRST) |
| 348 | struct T { |
| 349 | private: |
| 350 | }; |
| 351 | void T_Constructors() { |
| 352 | // Trigger creation of implicit contructors |
| 353 | T foo; |
| 354 | T bar = foo; |
| 355 | T baz(bar); |
| 356 | } |
| 357 | #elif defined(SECOND) |
| 358 | struct T { |
| 359 | public: |
| 360 | }; |
| 361 | #else |
| 362 | T t; |
| 363 | // expected-error@first.h:* {{'ImplicitDecl::T' has different definitions in different modules; first difference is definition in module 'FirstModule' found private access specifier}} |
| 364 | // expected-note@second.h:* {{but in 'SecondModule' found public access specifier}} |
| 365 | #endif |
| 366 | |
| 367 | } // namespace ImplicitDelc |
| 368 | |
| 369 | namespace TemplatedClass { |
| 370 | #if defined(FIRST) |
| 371 | template <class> |
| 372 | struct S {}; |
| 373 | #elif defined(SECOND) |
| 374 | template <class> |
| 375 | struct S {}; |
| 376 | #else |
| 377 | S<int> s; |
| 378 | #endif |
| 379 | |
| 380 | #if defined(FIRST) |
| 381 | template <class> |
| 382 | struct T { |
| 383 | private: |
| 384 | }; |
| 385 | #elif defined(SECOND) |
| 386 | template <class> |
| 387 | struct T { |
| 388 | public: |
| 389 | }; |
| 390 | #else |
| 391 | T<int> t; |
| 392 | // expected-error@second.h:* {{'TemplatedClass::T' has different definitions in different modules; first difference is definition in module 'SecondModule' found public access specifier}} |
| 393 | // expected-note@first.h:* {{but in 'FirstModule' found private access specifier}} |
| 394 | #endif |
| 395 | } // namespace TemplatedClass |
| 396 | |
| 397 | namespace TemplateClassWithField { |
| 398 | #if defined(FIRST) |
| 399 | template <class A> |
| 400 | struct S { |
| 401 | A a; |
| 402 | }; |
| 403 | #elif defined(SECOND) |
| 404 | template <class A> |
| 405 | struct S { |
| 406 | A a; |
| 407 | }; |
| 408 | #else |
| 409 | S<int> s; |
| 410 | #endif |
| 411 | |
| 412 | #if defined(FIRST) |
| 413 | template <class A> |
| 414 | struct T { |
| 415 | A a; |
| 416 | |
| 417 | private: |
| 418 | }; |
| 419 | #elif defined(SECOND) |
| 420 | template <class A> |
| 421 | struct T { |
| 422 | A a; |
| 423 | |
| 424 | public: |
| 425 | }; |
| 426 | #else |
| 427 | T<int> t; |
| 428 | // expected-error@second.h:* {{'TemplateClassWithField::T' has different definitions in different modules; first difference is definition in module 'SecondModule' found public access specifier}} |
| 429 | // expected-note@first.h:* {{but in 'FirstModule' found private access specifier}} |
| 430 | #endif |
| 431 | } // namespace TemplateClassWithField |
| 432 | |
| 433 | namespace TemplateClassWithTemplateField { |
| 434 | #if defined(FIRST) |
| 435 | template <class A> |
| 436 | class WrapperS; |
| 437 | template <class A> |
| 438 | struct S { |
| 439 | WrapperS<A> a; |
| 440 | }; |
| 441 | #elif defined(SECOND) |
| 442 | template <class A> |
| 443 | class WrapperS; |
| 444 | template <class A> |
| 445 | struct S { |
| 446 | WrapperS<A> a; |
| 447 | }; |
| 448 | #else |
| 449 | template <class A> |
| 450 | class WrapperS{}; |
| 451 | S<int> s; |
| 452 | #endif |
| 453 | |
| 454 | #if defined(FIRST) |
| 455 | template <class A> |
| 456 | class WrapperT; |
| 457 | template <class A> |
| 458 | struct T { |
| 459 | WrapperT<A> a; |
| 460 | |
| 461 | public: |
| 462 | }; |
| 463 | #elif defined(SECOND) |
| 464 | template <class A> |
| 465 | class WrapperT; |
| 466 | template <class A> |
| 467 | struct T { |
| 468 | WrapperT<A> a; |
| 469 | |
| 470 | private: |
| 471 | }; |
| 472 | #else |
| 473 | template <class A> |
| 474 | class WrapperT{}; |
| 475 | T<int> t; |
| 476 | // expected-error@second.h:* {{'TemplateClassWithTemplateField::T' has different definitions in different modules; first difference is definition in module 'SecondModule' found private access specifier}} |
| 477 | // expected-note@first.h:* {{but in 'FirstModule' found public access specifier}} |
| 478 | #endif |
| 479 | } // namespace TemplateClassWithTemplateField |
| 480 | |
| 481 | namespace EnumWithForwardDeclaration { |
| 482 | #if defined(FIRST) |
| 483 | enum E : int; |
| 484 | struct S { |
| 485 | void get(E) {} |
| 486 | }; |
| 487 | #elif defined(SECOND) |
| 488 | enum E : int { A, B }; |
| 489 | struct S { |
| 490 | void get(E) {} |
| 491 | }; |
| 492 | #else |
| 493 | S s; |
| 494 | #endif |
| 495 | |
| 496 | #if defined(FIRST) |
| 497 | struct T { |
| 498 | void get(E) {} |
| 499 | public: |
| 500 | }; |
| 501 | #elif defined(SECOND) |
| 502 | struct T { |
| 503 | void get(E) {} |
| 504 | private: |
| 505 | }; |
| 506 | #else |
| 507 | T t; |
| 508 | // expected-error@second.h:* {{'EnumWithForwardDeclaration::T' has different definitions in different modules; first difference is definition in module 'SecondModule' found private access specifier}} |
| 509 | // expected-note@first.h:* {{but in 'FirstModule' found public access specifier}} |
| 510 | #endif |
| 511 | } // namespace EnumWithForwardDeclaration |
| 512 | |
| 513 | namespace StructWithForwardDeclaration { |
| 514 | #if defined(FIRST) |
| 515 | struct P {}; |
| 516 | struct S { |
| 517 | struct P *ptr; |
| 518 | }; |
| 519 | #elif defined(SECOND) |
| 520 | struct S { |
| 521 | struct P *ptr; |
| 522 | }; |
| 523 | #else |
| 524 | S s; |
| 525 | #endif |
| 526 | |
| 527 | #if defined(FIRST) |
| 528 | struct Q {}; |
| 529 | struct T { |
| 530 | struct Q *ptr; |
| 531 | public: |
| 532 | }; |
| 533 | #elif defined(SECOND) |
| 534 | struct T { |
| 535 | struct Q *ptr; |
| 536 | private: |
| 537 | }; |
| 538 | #else |
| 539 | T t; |
| 540 | // expected-error@second.h:* {{'StructWithForwardDeclaration::T' has different definitions in different modules; first difference is definition in module 'SecondModule' found private access specifier}} |
| 541 | // expected-note@first.h:* {{but in 'FirstModule' found public access specifier}} |
| 542 | #endif |
| 543 | } // namespace StructWithForwardDeclaration |
| 544 | |
| 545 | namespace StructWithForwardDeclarationNoDefinition { |
| 546 | #if defined(FIRST) |
| 547 | struct P; |
| 548 | struct S { |
| 549 | struct P *ptr; |
| 550 | }; |
| 551 | #elif defined(SECOND) |
| 552 | struct S { |
| 553 | struct P *ptr; |
| 554 | }; |
| 555 | #else |
| 556 | S s; |
| 557 | #endif |
| 558 | |
| 559 | #if defined(FIRST) |
| 560 | struct Q; |
| 561 | struct T { |
| 562 | struct Q *ptr; |
| 563 | |
| 564 | public: |
| 565 | }; |
| 566 | #elif defined(SECOND) |
| 567 | struct T { |
| 568 | struct Q *ptr; |
| 569 | |
| 570 | private: |
| 571 | }; |
| 572 | #else |
| 573 | T t; |
| 574 | // expected-error@second.h:* {{'StructWithForwardDeclarationNoDefinition::T' has different definitions in different modules; first difference is definition in module 'SecondModule' found private access specifier}} |
| 575 | // expected-note@first.h:* {{but in 'FirstModule' found public access specifier}} |
| 576 | #endif |
| 577 | } // namespace StructWithForwardDeclarationNoDefinition |
| 578 | |
| 579 | // Keep macros contained to one file. |
| 580 | #ifdef FIRST |
| 581 | #undef FIRST |
| 582 | #endif |
| 583 | #ifdef SECOND |
| 584 | #undef SECOND |
| 585 | #endif |