mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 09:46:02 +02:00
Bug 483824 - Inline namespace reopened without inline keyword
Change-Id: Ia2e15b31356c2e2a2ab53ed6fd76138177ed40bb
This commit is contained in:
parent
bfea9deb90
commit
eb795e9518
3 changed files with 24 additions and 2 deletions
|
@ -1759,6 +1759,20 @@ public class IndexCPPBindingResolutionTest extends IndexBindingResolutionTestBas
|
|||
getBindingFromASTName("g(1)", 1);
|
||||
}
|
||||
|
||||
// namespace std {
|
||||
// inline namespace __cxx11 { }
|
||||
// }
|
||||
|
||||
// namespace std {
|
||||
// namespace __cxx11 {
|
||||
// class string {};
|
||||
// }
|
||||
// void regex_match(string); // Type 'string' could not be resolved
|
||||
// }
|
||||
public void testInlineNamespaceReopenedWithoutInlineKeyword_483824() {
|
||||
checkBindings();
|
||||
}
|
||||
|
||||
// namespace ns {
|
||||
// void fun();
|
||||
// }
|
||||
|
|
|
@ -307,8 +307,8 @@ abstract public class CPPScope implements ICPPASTInternalScope {
|
|||
@Override
|
||||
public final void populateCache() {
|
||||
if (!isCached) {
|
||||
isCached= true; // set to true before doing the work, to avoid recursion
|
||||
CPPSemantics.populateCache(this);
|
||||
isCached= true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1612,7 +1612,15 @@ public class CPPSemantics {
|
|||
} else if (item instanceof ICPPASTNamespaceDefinition) {
|
||||
final ICPPASTNamespaceDefinition nsDef = (ICPPASTNamespaceDefinition) item;
|
||||
final boolean isUnnamed = nsDef.getName().getLookupKey().length == 0;
|
||||
final boolean isInline = nsDef.isInline();
|
||||
boolean isInline = nsDef.isInline();
|
||||
// An inline namespace can be re-opened without repeating the inline keyword,
|
||||
// so we need to consult the binding to check inlineness.
|
||||
if (!isUnnamed && !isInline) {
|
||||
IBinding nsBinding = nsDef.getName().resolveBinding();
|
||||
if (nsBinding instanceof ICPPNamespace) {
|
||||
isInline = ((ICPPNamespace) nsBinding).isInline();
|
||||
}
|
||||
}
|
||||
if (isUnnamed || isInline) {
|
||||
if (scope instanceof CPPNamespaceScope) {
|
||||
final CPPNamespaceScope nsscope = (CPPNamespaceScope) scope;
|
||||
|
|
Loading…
Add table
Reference in a new issue