File tree Expand file tree Collapse file tree 2 files changed +89
-0
lines changed Expand file tree Collapse file tree 2 files changed +89
-0
lines changed Original file line number Diff line number Diff line change 1+ // RUN: rm -rf %t
2+ // RUN: split-file %s %t
3+ // RUN: cd %t
4+ //
5+ // RUN: %clang_cc1 -std=c++20 -I %t %t/A.cppm -emit-module-interface -o %t/A.pcm -verify
6+ // RUN: %clang_cc1 -std=c++20 -I %t %t/B.cppm -emit-module-interface -o %t/B.pcm -verify
7+ // RUN: %clang_cc1 -std=c++20 -I %t %t/C.cpp -fmodule-file=A=%t/A.pcm -fmodule-file=B=%t/B.pcm -fsyntax-only -verify
8+
9+ // --- foo.h
10+ namespace baz {
11+ using foo = char ;
12+ using baz::foo;
13+ }
14+
15+ // --- bar.h
16+ class bar {
17+ bar (baz::foo);
18+ };
19+
20+ // --- A.cppm
21+ // expected-no-diagnostics
22+ module ;
23+ #include " foo.h"
24+ export module A;
25+ export using AX = baz::foo;
26+
27+ // --- B.cppm
28+ // expected-no-diagnostics
29+ module ;
30+ #include " foo.h"
31+ #include " bar.h"
32+ export module B;
33+ export using BX = baz::foo;
34+ export using BY = bar;
35+
36+ // --- C.cpp
37+ #include " foo.h"
38+ import A;
39+ #include " bar.h"
40+ import B;
41+ // Since modules are loaded lazily, force loading by performing a lookup.
42+ using xxx = bar;
43+ // FIXME: This is a false positive ODR violation.
44+ // [email protected] :2 {{'bar' has different definitions in different modules; first difference is defined here found constructor with 1st parameter of type 'baz::foo' (aka 'char')}}45+ // [email protected] :2 {{but in 'B.<global>' found constructor with 1st parameter of type 'baz::foo' (aka 'char')}}
Original file line number Diff line number Diff line change 1+ // RUN: rm -rf %t
2+ // RUN: split-file %s %t
3+ // RUN: cd %t
4+ //
5+ // RUN: %clang_cc1 -std=c++20 -I %t %t/A.cppm -emit-module-interface -o %t/A.pcm -verify
6+ // RUN: %clang_cc1 -std=c++20 -I %t %t/B.cpp -fmodule-file=A=%t/A.pcm -fsyntax-only -verify -ast-dump-all -ast-dump-filter baz | FileCheck %s
7+
8+ // --- foo.h
9+ namespace baz {
10+ using foo = char ;
11+ using baz::foo;
12+ }
13+
14+ // --- A.cppm
15+ // expected-no-diagnostics
16+ module ;
17+ #include " foo.h"
18+ export module A;
19+
20+ // --- B.cpp
21+ // expected-no-diagnostics
22+ #include " foo.h"
23+ import A;
24+ // Since modules are loaded lazily, force loading by performing a lookup.
25+ using xxx = baz::foo;
26+
27+ // CHECK-LABEL: Dumping baz:
28+ // CHECK-NEXT: NamespaceDecl {{.*}} imported in A.<global> {{.*}} baz
29+ // CHECK-NEXT: |-original Namespace {{.*}} 'baz'
30+ // CHECK-NEXT: |-TypeAliasDecl {{.*}} foo 'char'
31+ // CHECK-NEXT: | `-BuiltinType {{.*}} 'char'
32+ // CHECK-NEXT: |-UsingDecl {{.*}} baz::foo
33+ // CHECK-NEXT: | `-NestedNameSpecifier Namespace {{.*}} 'baz'
34+ // FIXME: UsingShadowDecl should have been merged
35+ // CHECK-NOT: `-UsingShadowDecl 0x{{[^ ]*}} prev 0x{{[^ ]*}} {{.*}} imported in A.<global> {{.*}} 'foo'
36+ // CHECK-NEXT: `-UsingShadowDecl 0x{{[^ ]*}} {{.*}} imported in A.<global> {{.*}} 'foo'
37+
38+ // CHECK-LABEL: Dumping baz:
39+ // CHECK-NEXT: NamespaceDecl {{.*}} baz
40+ // CHECK-NEXT: |-TypeAliasDecl {{.*}} foo 'char'
41+ // CHECK-NEXT: | `-BuiltinType {{.*}} 'char'
42+ // CHECK-NEXT: |-UsingDecl {{.*}} baz::foo
43+ // CHECK-NEXT: | `-NestedNameSpecifier Namespace {{.*}} 'baz'
44+ // CHECK-NEXT: `-UsingShadowDecl 0x[[SHADOW_ADDR:[^ ]*]] {{.*}} 'foo'
You can’t perform that action at this time.
0 commit comments