mirror of https://github.com/microsoft/clang.git
[modules] Add test for using declaration in classes.
Summary: This adds a test that checks if the using declaration in classes still works as intended with modules. The motivation for this is that we tried to add a shortcut to `removeDecl` that would skip the removal of declarations from the lookup table if they are hidden. This optimization passed the clang test suite but actually broke the using declaration in combination with -fmodules-local-submodule-visibility. In this mode we hide all decls from other modules such as by chance the parent method, in which case don't remove the parent method from the lookup table and get ambiguous lookup errors. After this patch we now correctly see if this behavior is broken by a patch like this in the test suite. Reviewers: v.g.vassilev Reviewed By: v.g.vassilev Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D37180 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@311991 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
be837badf3
commit
868bd3047d
|
@ -0,0 +1,34 @@
|
|||
// RUN: %clang_cc1 -x c++ -fmodules -fmodules-local-submodule-visibility -fmodules-cache-path=%t %s -verify
|
||||
// RUN: %clang_cc1 -x c++ -fmodules -fmodules-cache-path=%t %s -verify
|
||||
|
||||
// expected-no-diagnostics
|
||||
|
||||
#pragma clang module build A
|
||||
module A { }
|
||||
#pragma clang module contents
|
||||
#pragma clang module begin A
|
||||
struct A {
|
||||
virtual void Foo(double x) const;
|
||||
};
|
||||
#pragma clang module end
|
||||
#pragma clang module endbuild
|
||||
|
||||
#pragma clang module build B
|
||||
module B { }
|
||||
#pragma clang module contents
|
||||
#pragma clang module begin B
|
||||
#pragma clang module import A
|
||||
struct B : A {
|
||||
using A::Foo;
|
||||
virtual void Foo(double x) const;
|
||||
};
|
||||
#pragma clang module end
|
||||
#pragma clang module endbuild
|
||||
|
||||
#pragma clang module import B
|
||||
|
||||
int main() {
|
||||
B b;
|
||||
b.Foo(1.0);
|
||||
}
|
||||
|
Loading…
Reference in New Issue