A compilation error with clang++ was fixed in clang 16. See: $ cat foo.cc __attribute__ ((__deprecated__)) [[__nodiscard__]] int bar1 (int); // error in clang < 16 [[__nodiscard__]] __attribute__ ((__deprecated__)) int bar2 (int);
With clang 15: $ clang++ -S foo.cc foo.cc:1:34: error: an attribute list cannot appear here __attribute__ ((__deprecated__)) [[__nodiscard__]] int bar1 (int); // error in clang < 16 ^~~~~~~~~~~~~~~~~ 1 error generated. With clang 16: $ clang++ -S foo.cc This patch updates _GL_BRACKET_BEFORE_ATTRIBUTE accordingly. 2024-07-29 Bruno Haible <br...@clisp.org> An update for clang >= 16. * m4/gnulib-common.m4 (gl_COMMON_BODY): Don't define _GL_BRACKET_BEFORE_ATTRIBUTE with clang++ 16 or newer. diff --git a/m4/gnulib-common.m4 b/m4/gnulib-common.m4 index 71d90dfe71..9602c705e1 100644 --- a/m4/gnulib-common.m4 +++ b/m4/gnulib-common.m4 @@ -1,5 +1,5 @@ # gnulib-common.m4 -# serial 96 +# serial 97 dnl Copyright (C) 2007-2024 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -139,7 +139,7 @@ AC_DEFUN([gl_COMMON_BODY] various _GL_ATTRIBUTE_* can be cumulated on the same declaration in any order. */ #ifdef __cplusplus -# if defined __clang__ +# if defined __clang__ && __clang_major__ < 16 # define _GL_BRACKET_BEFORE_ATTRIBUTE 1 # endif #else