aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimple-range-cache.cc
diff options
context:
space:
mode:
authorNathaniel Shead <nathanieloshead@gmail.com>2024-04-30 22:29:57 +1000
committerNathaniel Shead <nathanieloshead@gmail.com>2024-05-08 09:16:40 +1000
commite60032b382364897a58e67994baac896bcd03327 (patch)
tree6faac5475b3d2c80f9c694922db1b37344f126c4 /gcc/gimple-range-cache.cc
parent4421d35167b3083e0f2e4c84c91fded09a30cf22 (diff)
downloadgcc-e60032b382364897a58e67994baac896bcd03327.zip
gcc-e60032b382364897a58e67994baac896bcd03327.tar.gz
gcc-e60032b382364897a58e67994baac896bcd03327.tar.bz2
c++/modules: Stream unmergeable temporaries by value again [PR114856]
In r14-9266-g2823b4d96d9ec4 I gave all temporary vars a DECL_CONTEXT, including those at namespace or global scope, so that they could be properly merged across importers. However, not all of these temporary vars are actually supposed to be mergeable. For instance, in the attached testcase we have an unnamed temporary var used in the NSDMI of a class member, which cannot properly merged -- but it also doesn't need to be, as it'll be thrown away when the class type itself is merged anyway. This patch reverts the change made above and instead makes a weaker adjustment that only causes temporary vars with linkage have a DECL_CONTEXT to merge from. This way these unnamed, "unmergeable" temporaries are properly streamed by value again. PR c++/114856 gcc/cp/ChangeLog: * call.cc (make_temporary_var_for_ref_to_temp): Set context for temporaries with linkage. * init.cc (create_temporary_var): Revert to only set context when in a function decl. gcc/testsuite/ChangeLog: * g++.dg/modules/pr114856.h: New test. * g++.dg/modules/pr114856_a.H: New test. * g++.dg/modules/pr114856_b.C: New test. Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com> Reviewed-by: Jason Merrill <jason@redhat.com> Reviewed-by: Patrick Palka <ppalka@redhat.com>
Diffstat (limited to 'gcc/gimple-range-cache.cc')
0 files changed, 0 insertions, 0 deletions