On Sep 26, 2008, at 4:19 PM, Ted Kremenek wrote:
> Use a union instead of a bunch of magic casts to implement a
> variant. This removes the type-punning errors for DeclGroup.
This isn't safe either.
unions are a gcc extension not sanctions by the language standard and
they _only_ work when you have u.field1 and u.field2 in the source
code. The problem is you store as a Decl:
explicit DeclGroupRef(Decl* d) : D(d) {}
then, you fetch Raw:
Kind getKind() const { return (Kind) (Raw & Mask); }
when you call begin:
iterator begin() {
if (getKind() == DeclKind) return Raw ? &D : 0;
You have to fetch the same type you stored (or on of the other
loopholes previously mentioned).
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits