Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 31 Jan 2024 08:56:22 +0000
From:      bugzilla-noreply@freebsd.org
To:        toolchain@FreeBSD.org
Subject:   [Bug 276738] clang: static_assert conflicts with -std=c++98 -pedantic-errors
Message-ID:  <bug-276738-29464-EEXQAIzTv8@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-276738-29464@https.bugs.freebsd.org/bugzilla/>
References:  <bug-276738-29464@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D276738

--- Comment #3 from Henri Menke <henri@henrimenke.de> ---
I have narrowed this down a bit more. The following code doesn't preprocess
correctly

#include <cassert>
//#undef _Static_assert
static_assert(random_template<int, char>, "oops");

When running the preprocessor (with -E) I get

$ c++ -std=3Dc++98 -pedantic-errors -E test.cpp >/dev/null
test.cpp:3:43: error: too many arguments provided to function-like macro
invocation
    3 | static_assert(random_template<int, char>, "oops");
      |                                           ^
/usr/include/sys/cdefs.h:282:9: note: macro '_Static_assert' defined here
  282 | #define _Static_assert(x, y)    __Static_assert(x, __COUNTER__)
      |         ^
1 error generated.

If I uncomment the #undef _Static_assert it preprocesses correctly and upon
compiling it gives the expected compiler error that static_assert is not
available.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-276738-29464-EEXQAIzTv8>