Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHannes Vogt2019-04-29 19:56:49 +0000
committerNathan Ridge2019-04-29 21:15:52 +0000
commit571b21b2f546475d205a22a0f1b877510dba1ec6 (patch)
treee9886ef8386998dc4d28e093254f019eafab0df4
parentcde06e53541eb853842ae03cd1ed73b9e3fac7f9 (diff)
downloadorg.eclipse.cdt-571b21b2f546475d205a22a0f1b877510dba1ec6.tar.gz
org.eclipse.cdt-571b21b2f546475d205a22a0f1b877510dba1ec6.tar.xz
org.eclipse.cdt-571b21b2f546475d205a22a0f1b877510dba1ec6.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 44a914de25..58f292de81 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
@@ -13044,8 +13044,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