[Bug c++/98569] New: concept error message does not report the file location
nico at josuttis dot de
gcc-bugzilla@gcc.gnu.org
Wed Jan 6 16:59:30 GMT 2021
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98569
Bug ID: 98569
Summary: concept error message does not report the file
location
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: nico at josuttis dot de
Target Milestone: ---
Look here:
https://wandbox.org/permlink/6Di4rLNS5H9TNL2R
Here is what is wrong in the error message:
> prog.cc: In function 'int main()':
> prog.cc:18:14: error: no matching function for call to 'add(std::vector<std::atomic<int> >&, std::atomic<int>&)'
> 18 | add(aiVec, ai); // ERROR: cannot copy/move atomics
> | ^
> prog.cc:9:6: note: candidate: 'template<class Coll, class T> requires convertible_to<T, typename Coll::value_type> void add(Coll&, const T&)'
> 9 | void add(Coll& coll, const T& val)
> | ^~~
> prog.cc:9:6: note: template argument deduction/substitution failed:
> prog.cc:9:6: note: constraints not satisfied
> In file included from /opt/wandbox/gcc-head/include/c++/11.0.0/compare:39,
> from /opt/wandbox/gcc-head/include/c++/11.0.0/bits/stl_pair.h:65,
> from /opt/wandbox/gcc-head/include/c++/11.0.0/bits/stl_algobase.h:64,
> from /opt/wandbox/gcc-head/include/c++/11.0.0/bits/char_traits.h:39,
> from /opt/wandbox/gcc-head/include/c++/11.0.0/ios:40,
> from /opt/wandbox/gcc-head/include/c++/11.0.0/ostream:38,
> from /opt/wandbox/gcc-head/include/c++/11.0.0/iostream:39,
> from prog.cc:1:
> /opt/wandbox/gcc-head/include/c++/11.0.0/concepts: In substitution of 'template<class Coll, class T> requires convertible_to<T, typename Coll::value_type> void add(Coll&, const T&) [with Coll = std::vector<std::atomic<int> >; T = std::atomic<int>]':
^^^^^ HERE ^^^^
I assume that this has to be something like
prog.cc:9:6: In substitution ...
instead of:
/opt/wandbox/gcc-head/include/c++/11.0.0/concepts: In substitution ...
because it refers to my code not to any code in any header file.
> prog.cc:18:14: required from here
> /opt/wandbox/gcc-head/include/c++/11.0.0/concepts:72:13: required for the satisfaction of 'convertible_to<T, typename Coll::value_type>' [with T = std::atomic<int>; Coll = std::vector<std::atomic<int>, std::allocator<std::atomic<int> > >]
> /opt/wandbox/gcc-head/include/c++/11.0.0/concepts:72:30: note: the expression 'is_convertible_v<_From, _To> [with _From = std::atomic<int>; _To = std::atomic<int>]' evaluated to 'false'
> 72 | concept convertible_to = is_convertible_v<_From, _To>
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
More information about the Gcc-bugs
mailing list