Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHannes Vogt2019-04-29 15:56:49 -0400
committerHannes Vogt2019-04-29 15:56:53 -0400
commit53187c30c516f8092051904225dfd1b16e7c53e6 (patch)
tree893dc289a6cc799ce78d291a06e3578ba44fef0c
parent32ba5e791d5698f6e3f3f644b45d59c8627fb861 (diff)
downloadorg.eclipse.cdt-53187c30c516f8092051904225dfd1b16e7c53e6.tar.gz
org.eclipse.cdt-53187c30c516f8092051904225dfd1b16e7c53e6.tar.xz
org.eclipse.cdt-53187c30c516f8092051904225dfd1b16e7c53e6.zip
Bug 545756 - Fix aggregate init from string literal
Fix nested type for typedefs Change-Id: Ie8ff31c9db9f3112487760640885066ea8cb0fd3 Signed-off-by: Hannes Vogt <hannes@havogt.de>
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java3
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/AggregateInitialization.java3
2 files changed, 4 insertions, 2 deletions
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java
index f89cfcd547..94c9023c58 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java
@@ -13062,8 +13062,9 @@ public class AST2CPPTests extends AST2CPPTestBase {
bh.assertImplicitName("b{v};", 1, IProblemBinding.class);
}
+ // using my_char = char;
// struct type {
- // char data[2];
+ // my_char data[2];
// };
//
// type foo{"s"};
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/AggregateInitialization.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/AggregateInitialization.java
index fb1190eb5d..9397d19ee4 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/AggregateInitialization.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/AggregateInitialization.java
@@ -215,7 +215,8 @@ class AggregateInitialization {
*/
private static ICPPBasicType getBasicTypeFromArray(IType type) {
if (type instanceof IArrayType) {
- IType nested = SemanticUtil.getNestedType(((IArrayType) type).getType(), SemanticUtil.ALLCVQ);
+ IType nested = SemanticUtil.getNestedType(((IArrayType) type).getType(),
+ SemanticUtil.ALLCVQ | SemanticUtil.TDEF);
if (nested instanceof ICPPBasicType) {
return (ICPPBasicType) nested;
}

Back to the top