Lekensteyn added a comment. This looks reasonable to fix the problem at hand, but would it handle nested structures too?
struct s1 { short f1; // "int f1" is fine. }; struct s2 { struct s1 f2; int x; }; struct s3 { struct s2 f3; int x; }; struct s2 x1 = {0}; struct s3 x2 = {0}; produces this AST (`clang-check -ast-dump x.c --`): |-VarDecl 0x55e7bbc60390 <line:13:1, col:18> col:11 x1 'struct s2':'struct s2' cinit | `-InitListExpr 0x55e7bbc60498 <col:16, col:18> 'struct s2':'struct s2' | |-InitListExpr 0x55e7bbc604e8 <col:17> 'struct s1':'struct s1' | | `-ImplicitCastExpr 0x55e7bbc60530 <col:17> 'short' <IntegralCast> | | `-IntegerLiteral 0x55e7bbc60430 <col:17> 'int' 0 | `-ImplicitValueInitExpr 0x55e7bbc60548 <<invalid sloc>> 'int' |-VarDecl 0x55e7bbc605b0 <line:14:1, col:18> col:11 x2 'struct s3':'struct s3' cinit | `-InitListExpr 0x55e7bbc60678 <col:16, col:18> 'struct s3':'struct s3' | |-InitListExpr 0x55e7bbc606c8 <col:17> 'struct s2':'struct s2' | | |-InitListExpr 0x55e7bbc60718 <col:17> 'struct s1':'struct s1' | | | `-ImplicitCastExpr 0x55e7bbc60760 <col:17> 'short' <IntegralCast> | | | `-IntegerLiteral 0x55e7bbc60610 <col:17> 'int' 0 | | `-ImplicitValueInitExpr 0x55e7bbc60778 <<invalid sloc>> 'int' | `-ImplicitValueInitExpr 0x55e7bbc60788 <<invalid sloc>> 'int' Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D61838/new/ https://reviews.llvm.org/D61838 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits