llvm-project/clang/test/Modules/ModulesLocalNamespace.cppm
Chuanqi Xu 5f62c79106 [C++20] [Modules] Use current named module to do module local lookup
See the attached test for the motiviation.

Previously we dependent on the module ownership of the decl context to
perform module local lookup. But if the lookup is unqualified, we may
perform the lookup with canonical decl, which belongs to the incorrect
named module
2025-07-03 19:03:52 +08:00

48 lines
770 B
C++

// RUN: rm -rf %t
// RUN: mkdir -p %t
// RUN: split-file %s %t
//
// RUN: %clang_cc1 -std=c++20 %t/a.cppm -emit-module-interface -o %t/a.pcm
// RUN: %clang_cc1 -std=c++20 %t/m-a.cppm -emit-module-interface -o %t/m-a.pcm
// RUN: %clang_cc1 -std=c++20 %t/b.cppm -emit-module-interface -o %t/m-b.pcm \
// RUN: -fprebuilt-module-path=%t
// RUN: %clang_cc1 -std=c++20 %t/b.cpp -fsyntax-only -verify -fprebuilt-module-path=%t
//--- a.cppm
export module a;
namespace aa {
}
//--- m-a.cppm
export module m:a;
namespace aa {
struct A {};
}
//--- b.cppm
module m:b;
import :a;
namespace bb {
struct B {
void func(aa::A);
};
}
//--- b.cpp
// expected-no-diagnostics
module m:b.impl;
import a;
import :b;
namespace bb {
using namespace aa;
void B::func(A) {}
}