mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-08 08:45:44 +02:00
Test case for bug 265070.
This commit is contained in:
parent
d1019b8da6
commit
f2bf6c0fa9
3 changed files with 20 additions and 9 deletions
|
@ -3832,4 +3832,15 @@ public class AST2TemplateTests extends AST2BaseTest {
|
|||
String code= getAboveComment();
|
||||
parseAndCheckBindings(code, ParserLanguage.CPP);
|
||||
}
|
||||
|
||||
// template<int V>
|
||||
// struct A {
|
||||
// enum E { e };
|
||||
// };
|
||||
//
|
||||
// int x = A<0>::e;
|
||||
public void _testEnumeratorInTemplateInstance_265070() throws Exception {
|
||||
String code= getAboveComment();
|
||||
parseAndCheckBindings(code, ParserLanguage.CPP);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -536,7 +536,7 @@ public class CPPSemantics {
|
|||
}
|
||||
|
||||
static private void getAssociatedScopes(IType t, ObjectSet<IScope> namespaces,
|
||||
ObjectSet<ICPPClassType> classes, CPPASTTranslationUnit tu) throws DOMException{
|
||||
ObjectSet<ICPPClassType> classes, CPPASTTranslationUnit tu) throws DOMException {
|
||||
// 3.4.2-2
|
||||
if (t instanceof ICPPClassType) {
|
||||
ICPPClassType ct= (ICPPClassType) t;
|
||||
|
@ -576,7 +576,7 @@ public class CPPSemantics {
|
|||
}
|
||||
|
||||
static private ICPPNamespaceScope getContainingNamespaceScope(IBinding binding,
|
||||
CPPASTTranslationUnit tu) throws DOMException{
|
||||
CPPASTTranslationUnit tu) throws DOMException {
|
||||
if (binding == null) return null;
|
||||
IScope scope = binding.getScope();
|
||||
while (scope != null && !(scope instanceof ICPPNamespaceScope)) {
|
||||
|
@ -702,7 +702,7 @@ public class CPPSemantics {
|
|||
* @param data the lookup data created off a name
|
||||
* @param start either a scope or a name.
|
||||
*/
|
||||
static protected void lookup(LookupData data, Object start) throws DOMException{
|
||||
static protected void lookup(LookupData data, Object start) throws DOMException {
|
||||
final IIndexFileSet fileSet= getIndexFileSet(data);
|
||||
IASTNode blockItem= data.astName;
|
||||
if (blockItem == null)
|
||||
|
@ -1050,7 +1050,7 @@ public class CPPSemantics {
|
|||
data.inheritanceChain.remove(scope);
|
||||
}
|
||||
|
||||
private static boolean checkForAmbiguity(LookupData data, Object n, Object names) throws DOMException{
|
||||
private static boolean checkForAmbiguity(LookupData data, Object n, Object names) throws DOMException {
|
||||
if (names instanceof Object[]) {
|
||||
names = ArrayUtil.trim(Object.class, (Object[]) names);
|
||||
if (((Object[])names).length == 0)
|
||||
|
@ -1465,7 +1465,7 @@ public class CPPSemantics {
|
|||
* that transitive directives have been stored in the lookup-data. For qualified lookups the transitive directives
|
||||
* are considered if the lookup of the original directive returns empty.
|
||||
*/
|
||||
static private void lookupInNominated(LookupData data, ICPPNamespaceScope scope) throws DOMException{
|
||||
static private void lookupInNominated(LookupData data, ICPPNamespaceScope scope) throws DOMException {
|
||||
List<ICPPNamespaceScope> allNominated= data.usingDirectives.remove(scope);
|
||||
while (allNominated != null) {
|
||||
for (ICPPNamespaceScope nominated : allNominated) {
|
||||
|
@ -2620,7 +2620,7 @@ public class CPPSemantics {
|
|||
return null;
|
||||
}
|
||||
|
||||
public static IBinding[] findBindings(IScope scope, String name, boolean qualified) throws DOMException{
|
||||
public static IBinding[] findBindings(IScope scope, String name, boolean qualified) throws DOMException {
|
||||
return findBindings(scope, name.toCharArray(), qualified, null);
|
||||
}
|
||||
|
||||
|
@ -2628,7 +2628,7 @@ public class CPPSemantics {
|
|||
return findBindings(scope, name, qualified, null);
|
||||
}
|
||||
|
||||
public static IBinding[] findBindings(IScope scope, char[] name, boolean qualified, IASTNode beforeNode) throws DOMException{
|
||||
public static IBinding[] findBindings(IScope scope, char[] name, boolean qualified, IASTNode beforeNode) throws DOMException {
|
||||
CPPASTName astName = new CPPASTName();
|
||||
astName.setName(name);
|
||||
astName.setParent(ASTInternal.getPhysicalNodeOfScope(scope));
|
||||
|
|
|
@ -931,7 +931,7 @@ public class CPPVisitor extends ASTQueries {
|
|||
}
|
||||
}
|
||||
if (i > 0) {
|
||||
IBinding binding = names[i-1].resolveBinding();
|
||||
IBinding binding = names[i - 1].resolveBinding();
|
||||
while (binding instanceof ITypedef) {
|
||||
IType t = ((ITypedef) binding).getType();
|
||||
if (t instanceof IBinding)
|
||||
|
@ -954,7 +954,7 @@ public class CPPVisitor extends ASTQueries {
|
|||
}
|
||||
if (done) {
|
||||
if (scope == null) {
|
||||
return new CPPScope.CPPScopeProblem(names[i-1], IProblemBinding.SEMANTIC_BAD_SCOPE);
|
||||
return new CPPScope.CPPScopeProblem(names[i - 1], IProblemBinding.SEMANTIC_BAD_SCOPE);
|
||||
}
|
||||
return scope;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue