On Aug 5, 2024, at 13:54, Jakub Jelinek <ja...@redhat.com> wrote:
On Mon, Aug 05, 2024 at 01:48:25PM -0400, Jason Merrill wrote: On 8/5/24 9:53 AM, Jakub Jelinek wrote: On Mon, Aug 05, 2024 at 01:33:01PM +0000, Qing Zhao wrote: As discussed in PR116016:https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116016#c48 We should explicitly document this limitation and issue error messages for C++. The "counted_by" attribute currently is only supported in C, mention this explicitly in documentation and also issue error when see "counted_by" attribute in C++. The patch has been bootstrappped and regression tested on both aarch64 and X86, no issue. + /* This attribute is not supported in C++. */ + if (c_dialect_cxx ()) + { + error_at (DECL_SOURCE_LOCATION (decl), + "%qE attribute is not supported for C++", name); This should be sorry_at instead IMHO (at least if there is a plan to support it later, hopefully in the 15 timeframe). Why should it be an error at all? A warning seems sufficient since there's no semantic effect. Ok. Guess OPT_Wattributes then. Okay. Qing Jakub