| 1 |
// RUN: rm -rf %t |
| 2 |
// RUN: mkdir %t |
| 3 |
// RUN: split-file --leading-lines %s %t |
| 4 |
// RUN: %clang_cc1 -std=c++20 -pedantic-errors -fexceptions -fcxx-exceptions %t/cwg279_A.cppm -triple x86_64-unknown-unknown -emit-module-interface -o %t/cwg279_A.pcm |
| 5 |
// RUN: %clang_cc1 -std=c++20 -verify=since-cxx20 -pedantic-errors -fexceptions -fcxx-exceptions -triple x86_64-unknown-unknown %t/cwg279.cpp -fmodule-file=cwg279_A=%t/cwg279_A.pcm |
| 6 |
// RUN: %clang_cc1 -std=c++23 -pedantic-errors -fexceptions -fcxx-exceptions %t/cwg279_A.cppm -triple x86_64-unknown-unknown -emit-module-interface -o %t/cwg279_A.pcm |
| 7 |
// RUN: %clang_cc1 -std=c++23 -verify=since-cxx20 -pedantic-errors -fexceptions -fcxx-exceptions -triple x86_64-unknown-unknown %t/cwg279.cpp -fmodule-file=cwg279_A=%t/cwg279_A.pcm |
| 8 |
// RUN: %clang_cc1 -std=c++2c -pedantic-errors -fexceptions -fcxx-exceptions %t/cwg279_A.cppm -triple x86_64-unknown-unknown -emit-module-interface -o %t/cwg279_A.pcm |
| 9 |
// RUN: %clang_cc1 -std=c++2c -verify=since-cxx20 -pedantic-errors -fexceptions -fcxx-exceptions -triple x86_64-unknown-unknown %t/cwg279.cpp -fmodule-file=cwg279_A=%t/cwg279_A.pcm |
| 10 |
|
| 11 |
// cwg279: no |
| 12 |
|
| 13 |
//--- cwg279_A.cppm |
| 14 |
export module cwg279_A; |
| 15 |
|
| 16 |
export { |
| 17 |
struct S; // #cwg279-S |
| 18 |
extern S *q; // #cwg279-q |
| 19 |
|
| 20 |
struct S2 {}; // #cwg279-S2 |
| 21 |
extern S2 *q2; // #cwg279-q2 |
| 22 |
|
| 23 |
struct S3 {}; // #cwg279-S3 |
| 24 |
extern S3 *q3; // #cwg279-q3 |
| 25 |
} // export |
| 26 |
|
| 27 |
//--- cwg279.cpp |
| 28 |
import cwg279_A; |
| 29 |
|
| 30 |
// FIXME: We should use markers instead. They are less fragile, |
| 31 |
// but -verify doesn't support them across modules yet. |
| 32 |
// FIXME: This is well-formed. Previous "definition" is actually just a declaration. |
| 33 |
typedef struct {} S; |
| 34 |
// since-cxx20-error@-1 {{typedef redefinition with different types ('struct S' vs 'S')}} |
| 35 |
// since-cxx20-note@cwg279_A.cppm:17 {{previous definition is here}} |
| 36 |
extern S *q; |
| 37 |
// since-cxx20-error@-1 {{declaration of 'q' in the global module follows declaration in module cwg279_A}} |
| 38 |
// since-cxx20-note@cwg279_A.cppm:18 {{previous declaration is here}} |
| 39 |
|
| 40 |
typedef struct {} S2; |
| 41 |
// since-cxx20-error@-1 {{typedef redefinition with different types ('struct S2' vs 'S2')}} |
| 42 |
// since-cxx20-note@cwg279_A.cppm:20 {{previous definition is here}} |
| 43 |
extern S2 *q2; |
| 44 |
// since-cxx20-error@-1 {{declaration of 'q2' in the global module follows declaration in module cwg279_A}} |
| 45 |
// since-cxx20-note@cwg279_A.cppm:21 {{previous declaration is here}} |
| 46 |
|
| 47 |
// FIXME: This is well-formed, because [basic.def.odr]/15 is satisfied. |
| 48 |
struct S3 {}; |
| 49 |
// since-cxx20-error@-1 {{declaration of 'S3' in the global module follows declaration in module cwg279_A}} |
| 50 |
// since-cxx20-note@cwg279_A.cppm:23 {{previous declaration is here}} |
| 51 |
extern S3 *q3; |
| 52 |
// since-cxx20-error@-1 {{declaration of 'q3' in the global module follows declaration in module cwg279_A}} |
| 53 |
// since-cxx20-note@cwg279_A.cppm:24 {{previous declaration is here}} |