https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69699

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to bastian.beischer from comment #3)
> Jonathan, maybe so but it should be mentioned on the page nevertheless,
> right?

Yes, although I plan to deprecate that macro.

> My issue is that we are using (as an example):
> 
> #if (defined(__GLIBCXX__) && __GLIBCXX__ > 20150626) ||
> (defined(_LIBCPP_VERSION) && _LIBCPP_VERSION >= 1101)
> static_assert(std::is_trivially_constructible<MyClass>::value, "MyClass
> should be trivially constructible.");
> #endif
> 
> since "std_is_trivially_constructible" exists only in libstdc++ shipped with
> GCC 5.1.0+, but not in libstdc++ shipped with GCC 4.9.3, for example.
>
> If i understand your comment correctly you are saying that, if GCC 4.9.4
> were released, it would include a version of libstdc++ with __GLIBCXX__ >
> today, so it would pass the above check, but still there would't be any
> "std_is_trivially_constructible".

Exactly. GCC 4.9.4 definitely will be released, and when it is your check will
not work. Someone could even use a version of GCC 4.9.3 built from the
gcc-4_9-branch in subversion, and your check would fail today.

> But how else can I do the check then?! Using __GNUC__ / __GNUC_MINOR__ is
> not going to work because we have people using other compilers (clang, Intel
> compiler) which use libstdc++ shipped with GCC but do not define __GNUC__ /
> __GNUC_MINOR__.

We need a macro that actually reflects the version of the library, not one that
refers to the almost meaningless release date.

Reply via email to