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

            Bug ID: 94645
           Summary: incorrect concecpt evaluation with decltype, plus
                    internal erropr
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: a...@cloudius-systems.com
  Target Milestone: ---

Created attachment 48303
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48303&action=edit
reduced test case (before preprocessing)

A concept involving decltype() fails to evaludate correctly in gcc 10, with
some indication the compiler has an internal error.

The same program compiles in gcc9 (with -fconcepts).

Reduced program and preprocessed output attached.

gcc 10 command line:

    g++  -std=gnu++2a -Wall -Werror  -c -o /dev/null reduced.cc 

gcc 9 command line:

    g++  -std=gnu++2a -fconcepts -Wall -Werror  -c -o /dev/null reduced.cc

gcc 10 errors:

In file included from /usr/include/c++/10/bits/stl_algobase.h:71,
                 from /usr/include/c++/10/algorithm:61,
                 from reduced.cc:1:
/usr/include/c++/10/bits/predefined_ops.h: In instantiation of 'constexpr bool
__gnu_cxx::__ops::_Iter_pred<_Predicate>::operator()(_Iterator) [with _Iterator
= std::__detail::_Node_const_iterator<std::pair<const
std::__cxx11::basic_string<char>, p::feature>, false, true>; _Predicate =
operator<<(std::ostream&, l<p>)::<lambda(const value_type&)>]':
/usr/include/c++/10/bits/stl_algobase.h:1906:42:   required from 'constexpr
_InputIterator std::__find_if(_InputIterator, _InputIterator, _Predicate,
std::input_iterator_tag) [with _InputIterator =
std::__detail::_Node_const_iterator<std::pair<const
std::__cxx11::basic_string<char>, p::feature>, false, true>; _Predicate =
__gnu_cxx::__ops::_Iter_pred<operator<<(std::ostream&, l<p>)::<lambda(const
value_type&)> >]'
/usr/include/c++/10/bits/stl_algobase.h:1965:23:   required from 'constexpr
_Iterator std::__find_if(_Iterator, _Iterator, _Predicate) [with _Iterator =
std::__detail::_Node_const_iterator<std::pair<const
std::__cxx11::basic_string<char>, p::feature>, false, true>; _Predicate =
__gnu_cxx::__ops::_Iter_pred<operator<<(std::ostream&, l<p>)::<lambda(const
value_type&)> >]'
/usr/include/c++/10/bits/stl_algo.h:3928:28:   required from 'constexpr _IIter
std::find_if(_IIter, _IIter, _Predicate) [with _IIter =
std::__detail::_Node_const_iterator<std::pair<const
std::__cxx11::basic_string<char>, p::feature>, false, true>; _Predicate =
operator<<(std::ostream&, l<p>)::<lambda(const value_type&)>]'
reduced.cc:12:7:   recursively required from 'std::ostream&
operator<<(std::ostream&, std::vector<a>) [with a = l<p>; std::ostream =
std::basic_ostream<char>]'
reduced.cc:12:7:   required from 'std::ostream& operator<<(std::ostream&,
std::vector<a>) [with a = std::vector<l<p> >; std::ostream =
std::basic_ostream<char>]'
reduced.cc:56:11:   required from 'void e::h<a>::g(const string_view&, const
string_view&) [with a = std::vector<l<p> >; std::string_view =
std::basic_string_view<char>]'
reduced.cc:23:10:   required from here
/usr/include/c++/10/bits/predefined_ops.h:316:23: error: no match for call to
'(operator<<(std::ostream&, l<p>)::<lambda(const value_type&)>) (const
std::pair<const std::__cxx11::basic_string<char>, p::feature>&)'
  316 |  { return bool(_M_pred(*__it)); }
      |                ~~~~~~~^~~~~~~
reduced.cc:37:17: note: candidate: 'operator<<(std::ostream&,
l<p>)::<lambda(const value_type&)>'
   37 |                 [opt](const typename m::value_type &) { return opt.n;
});
      |                 ^
reduced.cc:37:17: note: constraints not satisfied
reduced.cc: In instantiation of 'operator<<(std::ostream&, l<p>)::<lambda(const
value_type&)>':
/usr/include/c++/10/bits/predefined_ops.h:316:23:   required from 'constexpr
bool __gnu_cxx::__ops::_Iter_pred<_Predicate>::operator()(_Iterator) [with
_Iterator = std::__detail::_Node_const_iterator<std::pair<const
std::__cxx11::basic_string<char>, p::feature>, false, true>; _Predicate =
operator<<(std::ostream&, l<p>)::<lambda(const value_type&)>]'
/usr/include/c++/10/bits/stl_algobase.h:1906:42:   required from 'constexpr
_InputIterator std::__find_if(_InputIterator, _InputIterator, _Predicate,
std::input_iterator_tag) [with _InputIterator =
std::__detail::_Node_const_iterator<std::pair<const
std::__cxx11::basic_string<char>, p::feature>, false, true>; _Predicate =
__gnu_cxx::__ops::_Iter_pred<operator<<(std::ostream&, l<p>)::<lambda(const
value_type&)> >]'
/usr/include/c++/10/bits/stl_algobase.h:1965:23:   required from 'constexpr
_Iterator std::__find_if(_Iterator, _Iterator, _Predicate) [with _Iterator =
std::__detail::_Node_const_iterator<std::pair<const
std::__cxx11::basic_string<char>, p::feature>, false, true>; _Predicate =
__gnu_cxx::__ops::_Iter_pred<operator<<(std::ostream&, l<p>)::<lambda(const
value_type&)> >]'
/usr/include/c++/10/bits/stl_algo.h:3928:28:   required from 'constexpr _IIter
std::find_if(_IIter, _IIter, _Predicate) [with _IIter =
std::__detail::_Node_const_iterator<std::pair<const
std::__cxx11::basic_string<char>, p::feature>, false, true>; _Predicate =
operator<<(std::ostream&, l<p>)::<lambda(const value_type&)>]'
reduced.cc:12:7:   recursively required from 'std::ostream&
operator<<(std::ostream&, std::vector<a>) [with a = l<p>; std::ostream =
std::basic_ostream<char>]'
reduced.cc:12:7:   required from 'std::ostream& operator<<(std::ostream&,
std::vector<a>) [with a = std::vector<l<p> >; std::ostream =
std::basic_ostream<char>]'
reduced.cc:56:11:   required from 'void e::h<a>::g(const string_view&, const
string_view&) [with a = std::vector<l<p> >; std::string_view =
std::basic_string_view<char>]'
reduced.cc:23:10:   required from here
reduced.cc:26:31:   required for the satisfaction of 'HasMapInterface<decltype
(Mapper::map())>'

reduced.cc:26: confused by earlier errors, bailing out
Preprocessed source stored into /tmp/cccbFNij.out file, please attach this to
your bugreport.

Reply via email to