mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 22:52:11 +02:00
Bug 305987.
This commit is contained in:
parent
b4b9ae7689
commit
73175131ff
4 changed files with 63 additions and 7 deletions
|
@ -0,0 +1,41 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<launchConfiguration type="org.eclipse.pde.ui.JunitLaunchConfig">
|
||||
<booleanAttribute key="append.args" value="true"/>
|
||||
<stringAttribute key="application" value="org.eclipse.pde.junit.runtime.coretestapplication"/>
|
||||
<booleanAttribute key="askclear" value="false"/>
|
||||
<booleanAttribute key="automaticAdd" value="true"/>
|
||||
<booleanAttribute key="automaticValidate" value="false"/>
|
||||
<stringAttribute key="bootstrap" value=""/>
|
||||
<stringAttribute key="checked" value="[NONE]"/>
|
||||
<booleanAttribute key="clearConfig" value="true"/>
|
||||
<booleanAttribute key="clearws" value="true"/>
|
||||
<booleanAttribute key="clearwslog" value="false"/>
|
||||
<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/pde-junit"/>
|
||||
<booleanAttribute key="default" value="true"/>
|
||||
<booleanAttribute key="includeOptional" value="true"/>
|
||||
<stringAttribute key="location" value="${workspace_loc}/../junit-workspace"/>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
|
||||
<listEntry value="/org.eclipse.cdt.core.tests/suite/org/eclipse/cdt/core/suite/AutomatedIntegrationSuite.java"/>
|
||||
</listAttribute>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
|
||||
<listEntry value="1"/>
|
||||
</listAttribute>
|
||||
<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
|
||||
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
|
||||
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
|
||||
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit3"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.6.0_14"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.cdt.core.suite.AutomatedIntegrationSuite"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl}"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.cdt.core.tests"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xmx256m"/>
|
||||
<stringAttribute key="pde.version" value="3.3"/>
|
||||
<stringAttribute key="product" value="org.eclipse.sdk.ide"/>
|
||||
<booleanAttribute key="run_in_ui_thread" value="true"/>
|
||||
<booleanAttribute key="show_selected_only" value="false"/>
|
||||
<booleanAttribute key="tracing" value="false"/>
|
||||
<booleanAttribute key="useDefaultConfig" value="true"/>
|
||||
<booleanAttribute key="useDefaultConfigArea" value="false"/>
|
||||
<booleanAttribute key="useProduct" value="false"/>
|
||||
</launchConfiguration>
|
|
@ -8329,6 +8329,16 @@ public class AST2CPPTests extends AST2BaseTest {
|
|||
assertNull(x.getType());
|
||||
}
|
||||
|
||||
// struct A { auto a = 1; }; // Auto-typed non-static fields are not allowed.
|
||||
// struct B { static auto b = 1; }; // Auto-typed static fields are ok.
|
||||
public void testAutoType_305987() throws Exception {
|
||||
String code= getAboveComment();
|
||||
BindingAssertionHelper bh= new BindingAssertionHelper(code, true);
|
||||
ICPPVariable a= bh.assertNonProblem("a =", 1);
|
||||
assertNull(a.getType());
|
||||
ICPPVariable b= bh.assertNonProblem("b =", 1);
|
||||
}
|
||||
|
||||
// auto fpif1(int)->int(*)(int)
|
||||
// auto fpif2(int)->int(*)(int) {}
|
||||
public void testNewFunctionDeclaratorSyntax_305972() throws Exception {
|
||||
|
|
|
@ -2143,12 +2143,13 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
|
|||
* This function parses a declaration specifier sequence, as according to
|
||||
* the ANSI C++ specification.
|
||||
* declSpecifier :
|
||||
* "auto" | "register" | "static" | "extern" | "mutable" |
|
||||
* "register" | "static" | "extern" | "mutable" |
|
||||
* "inline" | "virtual" | "explicit" |
|
||||
* "typedef" | "friend" |
|
||||
* "const" | "volatile" |
|
||||
* "short" | "long" | "signed" | "unsigned" | "int" |
|
||||
* "char" | "wchar_t" | "bool" | "float" | "double" | "void" |
|
||||
* "char" | "wchar_t" | "bool" | "float" | "double" | "void" |
|
||||
* "auto" |
|
||||
* ("typename")? name |
|
||||
* { "class" | "struct" | "union" } classSpecifier |
|
||||
* {"enum"} enumSpecifier
|
||||
|
|
|
@ -191,7 +191,7 @@ public class CPPVisitor extends ASTQueries {
|
|||
public static final String TYPE_INFO= "type_info"; //$NON-NLS-1$
|
||||
private static final String INITIALIZER_LIST = "initializer_list"; //$NON-NLS-1$
|
||||
// Thread-local set of DeclSpecifiers for which auto types are being created.
|
||||
// Used for preventing infinite recursion while processing invalid self-referring
|
||||
// Used to prevent infinite recursion while processing invalid self-referencing
|
||||
// auto-type declarations.
|
||||
private static final ThreadLocal<Set<IASTDeclSpecifier>> autoTypeDeclSpecs =
|
||||
new ThreadLocal<Set<IASTDeclSpecifier>>() {
|
||||
|
@ -1792,6 +1792,10 @@ public class CPPVisitor extends ASTQueries {
|
|||
|
||||
if (declSpec instanceof ICPPASTSimpleDeclSpecifier &&
|
||||
((ICPPASTSimpleDeclSpecifier) declSpec).getType() == IASTSimpleDeclSpecifier.t_auto) {
|
||||
if (declarator instanceof ICPPASTFunctionDeclarator) {
|
||||
return createAutoFunctionType(declSpec, (ICPPASTFunctionDeclarator) declarator);
|
||||
}
|
||||
|
||||
parent = parent.getParent();
|
||||
if (parent instanceof ICPPASTNewExpression) {
|
||||
IASTInitializer initializer = ((ICPPASTNewExpression) parent).getInitializer();
|
||||
|
@ -1799,6 +1803,10 @@ public class CPPVisitor extends ASTQueries {
|
|||
if (arguments.length == 1) {
|
||||
initClause = arguments[0];
|
||||
}
|
||||
} else if (parent instanceof IASTCompositeTypeSpecifier &&
|
||||
declSpec.getStorageClass() != IASTDeclSpecifier.sc_static) {
|
||||
// Non-static auto-typed class members are not allowed.
|
||||
return null;
|
||||
}
|
||||
return createAutoType(initClause, declSpec, declarator);
|
||||
}
|
||||
|
@ -1825,10 +1833,6 @@ public class CPPVisitor extends ASTQueries {
|
|||
|
||||
private static IType createAutoType(IASTNode initClause, IASTDeclSpecifier declSpec, IASTDeclarator declarator) {
|
||||
// C++0x: 7.1.6.4
|
||||
if (declarator instanceof ICPPASTFunctionDeclarator) {
|
||||
return createAutoFunctionType(declSpec, (ICPPASTFunctionDeclarator) declarator);
|
||||
}
|
||||
|
||||
if (!autoTypeDeclSpecs.get().add(declSpec)) {
|
||||
// Detected a self referring auto type, e.g.: auto x = x;
|
||||
return null;
|
||||
|
|
Loading…
Add table
Reference in a new issue