From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32608 invoked by alias); 30 Jan 2012 21:13:55 -0000 Received: (qmail 32598 invoked by uid 22791); 30 Jan 2012 21:13:55 -0000 X-SWARE-Spam-Status: No, hits=-2.9 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 30 Jan 2012 21:13:42 +0000 From: "joseph.h.garvin at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/52032] Function and class attributes should optionally take a bool parameter enabling them Date: Mon, 30 Jan 2012 21:39:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: joseph.h.garvin at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-01/txt/msg03583.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52032 --- Comment #4 from Joseph Garvin 2012-01-30 21:13:37 UTC --- That's why I put the severity as enhancement :) I thought of a better example. template void __attribute__((always_inline(force_inline))) foo() { // ... } Now you can choose whether to force inlining of foo on a per call site basis, which AFAICT there is no way to do in GCC currently. I don't think template specialization can accomplish the same -- the best you could do would be defining a function with a copy pasta of the same code but a different name. You couldn't have both versions call a common function because the force_inline parameter would need to apply to it as well.