[clang] [clang] fix merging of UsingShadowDecl (PR #80245)

Chuanqi Xu via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 1 21:08:09 PST 2024


================
@@ -0,0 +1,40 @@
+// RUN: rm -rf %t
+// RUN: split-file %s %t
+// RUN: cd %t
+//
+// RUN: %clang_cc1 -std=c++20 -I %t %t/A.cppm -emit-module-interface -o %t/A.pcm -verify
+// RUN: %clang_cc1 -std=c++20 -I %t %t/B.cppm -emit-module-interface -o %t/B.pcm -verify
+// 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
+
+//--- foo.h
+namespace baz {
+  using foo = char;
+  using baz::foo;
+}
+
+//--- bar.h
+class bar {
+  bar(baz::foo);
+};
+
+//--- A.cppm
+// expected-no-diagnostics
+module;
+#include "foo.h"
+export module A;
----------------
ChuanqiXu9 wrote:

```suggestion
export module A;
namespace baz {
    export using foo;
}
```

Otherwise the declarations may be discarded once we implement http://eel.is/c++draft/module.global.frag#4

https://github.com/llvm/llvm-project/pull/80245


More information about the cfe-commits mailing list