diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-12-20 18:11:52 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-12-20 18:11:52 +0000 |
commit | 2ccd89cff3f1c18b48f649240302446a7dae28b9 (patch) | |
tree | 47e2010c301d5bfe4e20a9cfacfd21c0f04de401 /test/Modules/module-private.cpp | |
parent | e7aa27a826f0b353713df6bfa0715818db8cde74 (diff) |
When performing name lookup for a redeclaration, ignore module
visibility restrictions. This ensures that all declarations of the
same entity end up in the same redeclaration chain, even if some of
those declarations aren't visible. While this may seem unfortunate to
some---why can't two C modules have different functions named
'f'?---it's an acknowedgment that a module does not introduce a new
"namespace" of names.
As part of this, stop merging the 'module-private' bit from previous
declarations to later declarations, because we want each declaration
in a module to stand on its own because this can effect, for example,
submodule visibility.
Note that this notion of names that are invisible to normal name
lookup but are available for redeclaration lookups is how we should
implement friend declarations and extern declarations within local
function scopes. I'm not tackling that problem now.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146980 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Modules/module-private.cpp')
-rw-r--r-- | test/Modules/module-private.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/test/Modules/module-private.cpp b/test/Modules/module-private.cpp index eb932a8eb8..bdfa2682ce 100644 --- a/test/Modules/module-private.cpp +++ b/test/Modules/module-private.cpp @@ -31,28 +31,28 @@ int test_broken() { // Check for private redeclarations of public entities. template<typename T> -class public_class_template; // expected-note{{previous declaration is here}} +class public_class_template; template<typename T> -__module_private__ class public_class_template; // expected-error{{__module_private__ declaration of 'public_class_template' follows public declaration}} +__module_private__ class public_class_template; -typedef int public_typedef; // expected-note{{previous declaration is here}} -typedef __module_private__ int public_typedef; // expected-error{{__module_private__ declaration of 'public_typedef' follows public declaration}} +typedef int public_typedef; +typedef __module_private__ int public_typedef; -extern int public_var; // expected-note{{previous declaration is here}} -extern __module_private__ int public_var; // expected-error{{__module_private__ declaration of 'public_var' follows public declaration}} +extern int public_var; +extern __module_private__ int public_var; -void public_func(); // expected-note{{previous declaration is here}} -__module_private__ void public_func(); // expected-error{{__module_private__ declaration of 'public_func' follows public declaration}} +void public_func(); +__module_private__ void public_func(); template<typename T> -void public_func_template(); // expected-note{{previous declaration is here}} +void public_func_template(); template<typename T> -__module_private__ void public_func_template(); // expected-error{{__module_private__ declaration of 'public_func_template' follows public declaration}} +__module_private__ void public_func_template(); -struct public_struct; // expected-note{{previous declaration is here}} -__module_private__ struct public_struct; // expected-error{{__module_private__ declaration of 'public_struct' follows public declaration}} +struct public_struct; +__module_private__ struct public_struct; // Check for attempts to make specializations private template<> __module_private__ void public_func_template<int>(); // expected-error{{template specialization cannot be declared __module_private__}} |