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

            Bug ID: 86192
           Summary: A not fully fixed bug?
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zhonghao at pku dot org.cn
  Target Milestone: ---

A previous bug report (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70377)
complains that g++ produces errors given a piece of valid code. The code is as
follow:

#include <array>
#include <cstddef>
#include <exception>

template <std::size_t N>
constexpr size_t simple_find(const std::array<int, N> &arg_array,
 const int &arg_value
 ) {
 for (size_t ctr = 0; ctr != N; ++ctr) {
 if ( arg_array[ ctr ] == arg_value ) {
 return ctr;
 }
 }
 throw std::out_of_range( "" );
}

static constexpr std::array<int, 3> some_ints { { 10, 11 } };

static_assert( simple_find( some_ints, 10 ) == static_cast<size_t>( 0 ), "" );
static_assert( simple_find( some_ints, 11 ) == static_cast<size_t>( 1 ), "" );

int main() { }

It is said that the bug is fixed since 6.1.0. I used the latest g++ to compile
the code, but it still produces many errors. 

BTW, clang++ compiles the above code without any error messages. Is this bug
fully fixed?

Reply via email to