1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-04 14:55:41 +02:00

Bug 545756 - Fix aggregate init from string literal

Fix nested type for typedefs

Change-Id: Ie8ff31c9db9f3112487760640885066ea8cb0fd3
Signed-off-by: Hannes Vogt <hannes@havogt.de>
This commit is contained in:
Hannes Vogt 2019-04-29 21:56:49 +02:00
parent 32ba5e791d
commit 53187c30c5
2 changed files with 4 additions and 2 deletions

View file

@ -13062,8 +13062,9 @@ public class AST2CPPTests extends AST2CPPTestBase {
bh.assertImplicitName("b{v};", 1, IProblemBinding.class); bh.assertImplicitName("b{v};", 1, IProblemBinding.class);
} }
// using my_char = char;
// struct type { // struct type {
// char data[2]; // my_char data[2];
// }; // };
// //
// type foo{"s"}; // type foo{"s"};

View file

@ -215,7 +215,8 @@ class AggregateInitialization {
*/ */
private static ICPPBasicType getBasicTypeFromArray(IType type) { private static ICPPBasicType getBasicTypeFromArray(IType type) {
if (type instanceof IArrayType) { 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) { if (nested instanceof ICPPBasicType) {
return (ICPPBasicType) nested; return (ICPPBasicType) nested;
} }