http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54511
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |NEW CC| |jason at gcc dot gnu.org AssignedTo|jakub at gcc dot gnu.org |unassigned at gcc dot | |gnu.org --- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-09-07 09:05:18 UTC --- Seems the bug is on the C++ FE side, we have different a VAR_DECLs. One is created by finish_anon_union -> build_anon_union_vars during tsubst_expr, but when tsubsting the a = 0; assignment that VAR_DECL is copied to a new VAR_DECL by tsubst_decl. Apparently build_anon_union_vars is called twice, once during parsing, once during instantiation, but all the pushdecls the second time look really weird and don't affect what VAR_DECLs the following code actually uses. I would expect that during tsubst either build_anon_union_vars isn't called at all and instead pt.c somehow adjusts when needed the VAR_DECLs that were already created (after tsubst_decling them), or create a new set of vars, but somehow arrange those to be registered as the local specializations of the old vars. Jason, could you please look at this? Thanks.