OK.
On Wed, Jan 4, 2017 at 8:52 AM, Nathan Sidwell <nat...@acm.org> wrote: > On 01/04/2017 12:36 AM, Jason Merrill wrote: >> >> On 01/03/2017 08:57 AM, Nathan Sidwell wrote: > > >>> + type = auto_node; >>> + if (by_reference_p) > > >>> + type = build_reference_type (type); >>> + by_reference_p = false; > > ^^^ here >>> >>> + if (!is_this && by_reference_p) >>> + type = build_reference_type (type); >> >> >> This looks like it will call build_reference_type twice in the explicit >> init case, producing a reference to reference. > > > Note the clearing of by_reference_p just above in this case, but I admit > that's confusing. Anyway, it's rendered moot by this patch which addresses: > >>> if (DECLTYPE_FOR_LAMBDA_CAPTURE (t)) >>> type = lambda_capture_field_type (type, >>> - DECLTYPE_FOR_INIT_CAPTURE (t)); >>> + DECLTYPE_FOR_INIT_CAPTURE (t), >>> + /*by_reference_p=*/false); >> >> >> Always passing false seems unlikely to be correct. > > > I wondered about that, but obviously failed to come up with a testcase to > expose it. This patch adds such a case, and exposes the need to add another > flag to DECLTYPE to indicate reference capture -- rather than wrap the > dependent capture in a reference type itself, as was previously the case. > > > ok? > > nathan > > -- > Nathan Sidwell