mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 22:52:11 +02:00
Revert "Revert "Bug 459940 - Sfinae in id-expression""
This reverts commit a3147f85b0
.
The regression manifests itself only during indexing but doesn't produce unresolved symbols in C++ editor. Restoring the original change since the regression is relatively benign. Will continue to investigate.
Change-Id: I1fdfb4c31a0d5c08c3bc88baaf11d36c708cd883
This commit is contained in:
parent
a3147f85b0
commit
7e3a37be7b
4 changed files with 36 additions and 2 deletions
|
@ -7561,6 +7561,31 @@ public class AST2TemplateTests extends AST2TestBase {
|
|||
parseAndCheckBindings();
|
||||
}
|
||||
|
||||
// template<typename _From>
|
||||
// struct is_convertible {};
|
||||
//
|
||||
// class function {
|
||||
// public:
|
||||
// template<typename _Functor, bool = is_convertible<_Functor>::type::value>
|
||||
// function(_Functor);
|
||||
// };
|
||||
//
|
||||
// class A {};
|
||||
//
|
||||
// struct B {
|
||||
// B(const char* s);
|
||||
// };
|
||||
//
|
||||
// template <class T> void waldo(const B& b);
|
||||
// template <class T> void waldo(function f);
|
||||
//
|
||||
// void test() {
|
||||
// waldo<A>(""); // problem on waldo
|
||||
// }
|
||||
public void testSfinaeInIdExpression_459940() throws Exception {
|
||||
parseAndCheckBindings();
|
||||
}
|
||||
|
||||
// template <typename>
|
||||
// struct M {
|
||||
// template <typename... Args>
|
||||
|
|
|
@ -85,7 +85,12 @@ import org.eclipse.core.runtime.CoreException;
|
|||
*/
|
||||
public class Value implements IValue {
|
||||
public static final int MAX_RECURSION_DEPTH = 25;
|
||||
// Value.UNKNOWN indicates general inability to determine a value. It doesn't have to be an error,
|
||||
// it could be that evaluation ran into a performance limit, or that we can't model this kind of
|
||||
// value (such as a pointer to a function).
|
||||
public static final Value UNKNOWN= new Value("<unknown>".toCharArray(), null); //$NON-NLS-1$
|
||||
// Value.ERROR indicates that an error, such as a substitution failure, occurred during evaluation.
|
||||
public static final Value ERROR= new Value("<error>".toCharArray(), null); //$NON-NLS-1$
|
||||
public static final Value NOT_INITIALIZED= new Value("<__>".toCharArray(), null); //$NON-NLS-1$
|
||||
private static final IType INT_TYPE= new CPPBasicType(ICPPBasicType.Kind.eInt, 0);
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ import org.eclipse.core.runtime.CoreException;
|
|||
*/
|
||||
public class EvalFixed extends CPPEvaluation {
|
||||
public static final ICPPEvaluation INCOMPLETE =
|
||||
new EvalFixed(ProblemType.UNKNOWN_FOR_EXPRESSION, PRVALUE, Value.UNKNOWN);
|
||||
new EvalFixed(ProblemType.UNKNOWN_FOR_EXPRESSION, PRVALUE, Value.ERROR);
|
||||
|
||||
private final IType fType;
|
||||
private final IValue fValue;
|
||||
|
@ -170,6 +170,10 @@ public class EvalFixed extends CPPEvaluation {
|
|||
IValue value = CPPTemplates.instantiateValue(fValue, tpMap, packOffset, within, maxdepth, point);
|
||||
if (type == fType && value == fValue)
|
||||
return this;
|
||||
// If an error occurred while instantiating the value (such as a substitution failure),
|
||||
// propagate that error.
|
||||
if (value == Value.ERROR)
|
||||
return EvalFixed.INCOMPLETE;
|
||||
return new EvalFixed(type, fValueCategory, value);
|
||||
}
|
||||
|
||||
|
|
|
@ -342,7 +342,7 @@ public class EvalID extends CPPDependentEvaluation {
|
|||
}
|
||||
|
||||
if (fieldOwner instanceof IProblemBinding || nameOwner instanceof IProblemBinding)
|
||||
return this;
|
||||
return EvalFixed.INCOMPLETE;
|
||||
|
||||
if (templateArgs == fTemplateArgs && fieldOwner == fFieldOwner && nameOwner == fNameOwner)
|
||||
return this;
|
||||
|
|
Loading…
Add table
Reference in a new issue