]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Do not use assume attribute for Clang [PR112467]
authorJonathan Wakely <jwakely@redhat.com>
Fri, 10 Nov 2023 21:06:15 +0000 (21:06 +0000)
committerJonathan Wakely <jwakely@redhat.com>
Sat, 11 Nov 2023 00:41:09 +0000 (00:41 +0000)
Clang has an 'assume' attribute, but it's a function attribute not a
statement attribute. The recently-added use of the statement form causes
an error with Clang.

libstdc++-v3/ChangeLog:

PR libstdc++/112467
* include/bits/stl_bvector.h (_M_assume_normalized): Do not use
statement form of assume attribute for Clang.

libstdc++-v3/include/bits/stl_bvector.h

index 2b91af2005f2d652f7b64ed7e2a39b509eac03a3..64f04c1f4f5996f91e9c05646ed9d98a5e01632f 100644 (file)
@@ -185,8 +185,10 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
     void
     _M_assume_normalized() const
     {
+#if __has_attribute(__assume__) && !defined(__clang__)
       unsigned int __ofst = _M_offset;
       __attribute__ ((__assume__ (__ofst < unsigned(_S_word_bit))));
+#endif
     }
 
     _GLIBCXX20_CONSTEXPR