forked from OSchip/llvm-project
[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 llvm-svn: 311991
This commit is contained in:
parent
284848d00c
commit
d8132c303e
|
@ -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