From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 0D1373851C0D; Fri, 7 Aug 2020 13:44:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0D1373851C0D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1596807877; bh=6dHnW8g/dDkkTGVvpbPh+/4V/eMU3ziMmrVNyEWuPf8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=OetbNKpvHzW467t9M0Z6NiyFr4KrdBY4aMTqxylKwCHeOsBor3P+6hjDvGw66dcLE pbj1y/EI6b7C0Y+T1Q2b0jxRctsJSuzjK0j3TcwlLDDPBrwSHqHqUz1Y/EqNz0GMjM nkFq6yQWFv97zOS3FiLmKwhJ4Wk1lf5esdeFgLEM= From: "msebor at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/96516] template + __attribute__((copy)) produce compiler errors Date: Fri, 07 Aug 2020 13:44:36 +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: 9.1.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: msebor 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: cc cf_reconfirmed_on bug_status everconfirmed 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Aug 2020 13:44:37 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D96516 Martin Sebor changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |msebor at gcc dot gnu.org Last reconfirmed| |2020-08-07 Status|UNCONFIRMED |NEW Ever confirmed|0 |1 --- Comment #1 from Martin Sebor --- I think the C++ front end needs to hold off applying the copy attribute unt= il the template it's on is instantiated. This is hardcoded for other attribut= es but not for copy, so it won't work very well with templates. This doesn't work correctly either (although probably for a different reaso= n): template __attribute__((returns_nonnull)) T foo () { return T (); } __attribute__((copy (foo))) void* bar () { return 0; } t.C:4:47: warning: =E2=80=98copy=E2=80=99 attribute ignored on a declaratio= n of a different kind than referenced symbol [-Wattributes] 4 | __attribute__((copy (foo))) void* bar () { return 0; } | ^=