mirror of https://github.com/microsoft/clang.git
[modules] Don't diagnose a conflict between two using-declarations that name equivalent internal linkage entities.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@257512 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
6e332e0b23
commit
d83e5d4cf4
|
@ -7797,6 +7797,10 @@ bool Sema::CheckUsingShadowDecl(UsingDecl *Using, NamedDecl *Orig,
|
|||
if (UsingShadowDecl *Shadow = dyn_cast<UsingShadowDecl>(*I))
|
||||
PrevShadow = Shadow;
|
||||
FoundEquivalentDecl = true;
|
||||
} else if (isEquivalentInternalLinkageDeclaration(D, Target)) {
|
||||
// We don't conflict with an existing using shadow decl of an equivalent
|
||||
// declaration, but we're not a redeclaration of it.
|
||||
FoundEquivalentDecl = true;
|
||||
}
|
||||
|
||||
if (isVisible(D))
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
struct string {};
|
||||
namespace N { typedef ::string clstring; }
|
||||
const int n = 0;
|
||||
namespace N { typedef ::string clstring; using ::n; }
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
#include "a.h"
|
|
@ -1,3 +1,4 @@
|
|||
module a { header "a.h" }
|
||||
module b { header "b.h" export * }
|
||||
module c { header "c.h" export * }
|
||||
module b { header "b.h" export a }
|
||||
module c { header "c.h" export a export b }
|
||||
module d { header "d.h" }
|
||||
|
|
|
@ -2,10 +2,20 @@
|
|||
// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t \
|
||||
// RUN: -fmodule-map-file=%S/Inputs/using-decl-redecl/module.modulemap \
|
||||
// RUN: -I%S/Inputs/using-decl-redecl \
|
||||
// RUN: -Wno-modules-ambiguous-internal-linkage \
|
||||
// RUN: -verify %s
|
||||
|
||||
#include "d.h"
|
||||
|
||||
const int n = 0;
|
||||
namespace M { using ::n; }
|
||||
|
||||
#include "c.h"
|
||||
|
||||
N::clstring y = b;
|
||||
|
||||
// Use a typo to trigger import of all declarations in N.
|
||||
N::clstrinh s; // expected-error {{did you mean 'clstring'}}
|
||||
// expected-note@a.h:2 {{here}}
|
||||
// expected-note@a.h:3 {{here}}
|
||||
|
||||
namespace M { using N::n; }
|
||||
|
|
Loading…
Reference in New Issue