mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
Bug 559313 - decltype evaluated as a write operation
If a variable is in a decl type specifier can't be evaluated as written. Change-Id: If78a567dab99e55c78e16c3b7f10c45bbd0a0606 Signed-off-by: Marco Stornelli <marco.stornelli@gmail.com>
This commit is contained in:
parent
2c266d91fc
commit
b5cde3b61c
2 changed files with 15 additions and 0 deletions
|
@ -245,4 +245,16 @@ public class VariableReadWriteFlagsTest extends AST2TestBase {
|
|||
a.assertReadWriteFlags("a = arr[0];", "arr", READ);
|
||||
a.assertReadWriteFlags("return arr[0];", "arr", READ);
|
||||
}
|
||||
|
||||
// class Test {
|
||||
// public:
|
||||
// int v;
|
||||
// void test() const {
|
||||
// decltype(v) o = 14;
|
||||
// }
|
||||
// };
|
||||
public void testDeclType() throws Exception {
|
||||
AssertionHelper a = getCPPAssertionHelper();
|
||||
a.assertReadWriteFlags("decltype(v) o = 14;", "v", READ);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ import org.eclipse.cdt.core.dom.ast.IASTCaseStatement;
|
|||
import org.eclipse.cdt.core.dom.ast.IASTCastExpression;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTCompoundStatement;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTConditionalExpression;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDoStatement;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTEqualsInitializer;
|
||||
|
@ -81,6 +82,8 @@ public abstract class VariableReadWriteFlags {
|
|||
return READ; // dimension
|
||||
} else if (parent instanceof IASTInitializerList) {
|
||||
return rwInInitializerList((IASTInitializerList) parent, indirection);
|
||||
} else if (parent instanceof IASTDeclSpecifier) {
|
||||
return READ;
|
||||
}
|
||||
return READ | WRITE; // fallback
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue