mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Bug 391190: Using address as template argument.
This commit is contained in:
parent
96385656cc
commit
5d6ea978bb
3 changed files with 24 additions and 2 deletions
|
@ -6056,4 +6056,19 @@ public class AST2TemplateTests extends AST2BaseTest {
|
||||||
public void testPointerToMemberAsDependentExpression_391001() throws Exception {
|
public void testPointerToMemberAsDependentExpression_391001() throws Exception {
|
||||||
parseAndCheckBindings(getAboveComment(), CPP, true);
|
parseAndCheckBindings(getAboveComment(), CPP, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// class Memory { };
|
||||||
|
// Memory memory;
|
||||||
|
// template<Memory* m> struct Container {
|
||||||
|
// struct iterator {
|
||||||
|
// int test;
|
||||||
|
// };
|
||||||
|
// };
|
||||||
|
// int main() {
|
||||||
|
// Container<&memory>::iterator it;
|
||||||
|
// it.test; // Field 'test' could not be resolved
|
||||||
|
// }
|
||||||
|
public void testAddressAsTemplateArgument_391190() throws Exception {
|
||||||
|
parseAndCheckBindings(getAboveComment(), CPP, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -370,7 +370,10 @@ public class Value implements IValue {
|
||||||
* Tests whether the value depends on a template parameter.
|
* Tests whether the value depends on a template parameter.
|
||||||
*/
|
*/
|
||||||
public static boolean isDependentValue(IValue nonTypeValue) {
|
public static boolean isDependentValue(IValue nonTypeValue) {
|
||||||
return nonTypeValue != null && nonTypeValue.getEvaluation() != null;
|
if (nonTypeValue == null)
|
||||||
|
return false;
|
||||||
|
ICPPEvaluation eval = nonTypeValue.getEvaluation();
|
||||||
|
return eval != null && eval.isValueDependent();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -30,6 +30,7 @@ import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.ICompositeType;
|
import org.eclipse.cdt.core.dom.ast.ICompositeType;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTConversionName;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTConversionName;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassScope;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassScope;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassSpecialization;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
|
||||||
|
@ -159,7 +160,10 @@ class PDOMCPPClassScope implements ICPPClassScope, IIndexScope {
|
||||||
if (!lookup.isPrefixLookup()) {
|
if (!lookup.isPrefixLookup()) {
|
||||||
if (CharArrayUtils.equals(fBinding.getNameCharArray(), nameChars)) {
|
if (CharArrayUtils.equals(fBinding.getNameCharArray(), nameChars)) {
|
||||||
if (CPPClassScope.shallReturnConstructors(lookup.getLookupName(), false)){
|
if (CPPClassScope.shallReturnConstructors(lookup.getLookupName(), false)){
|
||||||
return fBinding.getConstructors();
|
if (fBinding instanceof ICPPClassSpecialization) {
|
||||||
|
return ((ICPPClassSpecialization) fBinding).getConstructors(lookup.getLookupPoint());
|
||||||
|
}
|
||||||
|
return fBinding.getConstructors();
|
||||||
}
|
}
|
||||||
return new IBinding[] {getClassNameBinding()};
|
return new IBinding[] {getClassNameBinding()};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue