From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B374E3858C36; Wed, 27 Mar 2024 23:14:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B374E3858C36 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1711581249; bh=oILkLaGNm16kKz/z2k53fkZ6t8ViXlMOYfRDZKbvy8Y=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Li0K8rOZQK54y4F6trcfalodssnU6m1Eehrm1nGf1miU6UYtEdGWTf4y4PbuYZwug mxDjK4LrcbhiUCfZVHSK4Ah1yFG2n+0gPv7/li8VbWKLW6iBAa3m11KLFMYuMSaS5i BhYqRLsYi3MBLoTPxECeWPBamiJ2gIHdKqp2p/9k= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/114504] Non-structural type accepted as non-type template parameter type Date: Wed, 27 Mar 2024 23:14:09 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: NEW 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_status everconfirmed cf_reconfirmed_on Message-ID: In-Reply-To: References: 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=3D114504 Andrew Pinski changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever confirmed|0 |1 Last reconfirmed| |2024-03-27 --- Comment #1 from Andrew Pinski --- So it looks like it is just an issue with the way requires is handled. That is doing it outside of a requires rejects the code correctly: ``` ... template int f(void) { [] {};=20 return 0; } auto t =3D f(); ``` Is rejected correctly with: ``` : In instantiation of 'int f() [with T =3D NonStructuralType]': :24:30: required from here 24 | auto t =3D f(); | ~~~~~~~~~~~~~~~~~~~~^~ :20:9: error: 'NonStructuralType' is not a valid type for a template non-type parameter because it is not structural 20 | [] {}; | ^~~~~~~~~~ :10:9: note: 'NonStructuralType::a' is not public 10 | int a; | ^ ```=