From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 024F43858418; Sat, 3 Sep 2022 05:05:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 024F43858418 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1662181548; bh=GFbkF3CL+rbbBh20i8sZo4E1+PD1FJmjtNNSX7jLEx4=; h=From:To:Subject:Date:From; b=iLrToI660653NtQTZrXRiXXDhlrKrj6khTcfQjDGcz5TKMDFgLtieSHtCOeKalCv/ ypf7JKjD5ZtW4VQ0qSYPuMWbwI3qRMRG0jK0BUS2GhQch8S0ZJcvux1GCOcBaZJaK3 JfBnwHnoTFttsjxTT+EQC3DJmmDFN/g2l2VDvr2M= From: "Dylan.Ferris at amd dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/106821] New: Incorrect behavior when using type alias template containing unevaluated lambda expression in a template context Date: Sat, 03 Sep 2022 05:05:47 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 12.2.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: Dylan.Ferris at amd dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D106821 Bug ID: 106821 Summary: Incorrect behavior when using type alias template containing unevaluated lambda expression in a template context Product: gcc Version: 12.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: Dylan.Ferris at amd dot com Target Milestone: --- I have prepared three different examples for when this fails: https://godbolt.org/z/G8Eq5fo5G https://godbolt.org/z/fajvnfo91 https://godbolt.org/z/e9s9Ws5o7 In the first one, `z.obj.a()` should be valid because `obj` is simply an instantiation of the `A` template. In the second one, `z.a()` should be valid because `bar` is inheriting from= an instantiation of the `A` template. In the third one, `obj.a()` should be valid because `obj` is simply an instantiation of the `A` template. All three of these have the following in common: 1. `alias` contains an unevaluated lambda expression, ie. `decltype([]{})` 2. The instantiation of `alias` as the inherited type uses a template param= eter So, this means that the three examples correctly compile if we apply any of= the following workarounds: 1. "inline" the alias by replacing all instances of it with `A` (Requiring this workaround violates [temp.alias.2]) 2. Remove the unevaluated lambda expression from `alias` (such as replacing= it with `int`) 3. Remove the template parameter of `alias` 4. Instantiate `alias` with a fixed type such as `int`. The bug persists even under a variety of transformations. Such as: 1. Removing the template on `A` and instead making an expression such as: template using alias =3D std::conditional_t; 2. Providing `bar`'s template parameter a default value of `int` and subsequently using it I believe this is related to PR 92707, but here the type of the unevaluated lambda is used as a template parameter in each case, and it holds true in w= hat seems to be all template contexts.=