[Bug 276738] clang: static_assert conflicts with -std=c++98 -pedantic-errors

From: <bugzilla-noreply_at_freebsd.org>
Date: Wed, 31 Jan 2024 01:38:54 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=276738

Mark Millard <marklmi26-fbsd@yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |marklmi26-fbsd@yahoo.com

--- Comment #1 from Mark Millard <marklmi26-fbsd@yahoo.com> ---
static_assert was added to C++ in C++ 11: after C++ 98.

The /usr/include/c++/v1/__algorithm/iterator_operations.h code:

  template <class _Iter>
  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
  static void __validate_iter_reference() {
    static_assert(is_same<__deref_t<_Iter>, typename
iterator_traits<__remove_cvref_t<_Iter> >::reference>::value,
        "It looks like your iterator's `iterator_traits<It>::reference` does
not match the return type of "
        "dereferencing the iterator, i.e., calling `*it`. This is undefined
behavior according to [input.iterators] "
        "and can lead to dangling reference issues at runtime, so we are
flagging this.");
  }

is not compliant with the C++98 standard. But . . .

https://libcxx.llvm.org reports:

QUOTE
libc++ is a new implementation of the C++ standard library, targeting C++11 and
above.

Features and Goals
Correctness as defined by the C++11 standard.
END QUOTE

So: Not a bug. FreeBSD gave up on C++98 when it decided to be
based, in part, on libc++ .

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