Mercurial > projects > ldc
comparison ir/irtypestruct.cpp @ 1632:8c37dcd7cfde
Allow unions with void-initialized members.
author | Matti Niemenmaa <matti.niemenmaa+hg@iki.fi> |
---|---|
date | Sun, 13 Sep 2009 22:15:33 +0300 |
parents | 72f00d740665 |
children |
comparison
equal
deleted
inserted
replaced
1631:e16ea850ff81 | 1632:8c37dcd7cfde |
---|---|
1 #include "llvm/DerivedTypes.h" | 1 #include "llvm/DerivedTypes.h" |
2 | 2 |
3 #include "aggregate.h" | 3 #include "aggregate.h" |
4 #include "declaration.h" | 4 #include "declaration.h" |
5 #include "init.h" | |
5 #include "mtype.h" | 6 #include "mtype.h" |
6 | 7 |
7 #include "gen/irstate.h" | 8 #include "gen/irstate.h" |
8 #include "gen/tollvm.h" | 9 #include "gen/tollvm.h" |
9 #include "gen/logger.h" | 10 #include "gen/logger.h" |
92 // first fill in the fields with explicit initializers | 93 // first fill in the fields with explicit initializers |
93 VarDeclarationIter field_it(sd->fields); | 94 VarDeclarationIter field_it(sd->fields); |
94 for (; field_it.more(); field_it.next()) | 95 for (; field_it.more(); field_it.next()) |
95 { | 96 { |
96 // init is !null for explicit inits | 97 // init is !null for explicit inits |
97 if (field_it->init != NULL) | 98 if (field_it->init != NULL && !field_it->init->isVoidInitializer()) |
98 { | 99 { |
99 IF_LOG Logger::println("adding explicit initializer for struct field %s", | 100 IF_LOG Logger::println("adding explicit initializer for struct field %s", |
100 field_it->toChars()); | 101 field_it->toChars()); |
101 | 102 |
102 data[field_it.index] = *field_it; | 103 data[field_it.index] = *field_it; |