From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id AAD183858D28; Tue, 5 Dec 2023 09:01:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AAD183858D28 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1701766880; bh=pVqBsqxZM7hEAcqAmARc/LuREoYatg+vTeIywZyC4jE=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ICaZxMUK/PhtQMkYLUyzW9L0SXm9EBern9EJnrV2TmV/t1S6WRC36nNKaZK11tSCP y5hkE943qCtsQ+17OvpyIHYFA0JZha4p2NowC6ZvZpwguMCaIwio+WR44UP7lEn74l DFiHFeNNFVLJm+y+dYHNQst4Tvwxmnsg389ikGp0= From: "eng.ahmad.nour at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/112838] Compiler is unable to show the exact error location when calling copy ctor for a non-copyable object Date: Tue, 05 Dec 2023 09:01:20 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 10.5.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: eng.ahmad.nour at gmail dot com X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: DUPLICATE X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D112838 --- Comment #7 from Ahmad Nour --- (In reply to Andrew Pinski from comment #3) > (In reply to Ahmad Nour from comment #2) > >=20 > > Thanks for confirmation. > > I tried with clang-12 -Wall -Wextra main.cpp, but I didn't get that > > hint/note. Am I missing something? >=20 > Oh I tried with -std=3Dc++20 which provided that note. Sorry about that.= But > it might be the case that adding this for -std=3Dc++17 might be hard ... Hmmmmm this is what I'm getting with c++20. I can't find that note where it points to line #13 >> clang-12 -Wall -Wextra main.cpp -std=3Dc++20 In file included from main.cpp:1: In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/vector:6= 6: /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/stl= _uninitialized.h:137:7: error: static_assert failed due to requirement 'is_constructible>, const std::unique_ptr> &>::value' "result type must= be constructible from value type of input range" static_assert(is_constructible<_ValueType2, decltype(*__first)>::valu= e, ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/stl= _uninitialized.h:325:19: note: in instantiation of function template specialization 'std::uninitialized_copy<__gnu_cxx::__normal_iterator *, std::vector>>, std::unique_ptr *>' requested here { return std::uninitialized_copy(__first, __last, __result); } ^ /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/stl= _vector.h:558:9: note: in instantiation of function template specialization 'std::__uninitialized_copy_a<__gnu_cxx::__normal_iterator *, std::vector>>, std::unique_ptr *, std::unique_ptr>' requested here std::__uninitialized_copy_a(__x.begin(), __x.end(), ^ main.cpp:4:7: note: in instantiation of member function 'std::vector>::vector' requested here class NonCopyable ^ In file included from main.cpp:1: In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/vector:6= 2: In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/stl= _algo.h:62: In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/stl= _tempbuf.h:60: /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/stl= _construct.h:109:38: error: call to deleted constructor of 'std::unique_ptr' { ::new(static_cast(__p)) _Tp(std::forward<_Args>(__args)...); } ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/stl= _uninitialized.h:91:8: note: in instantiation of function template specialization 'std::_Construct, const std::unique_ptr &>' reque= sted here std::_Construct(std::__addressof(*__cur), *__first); ^ /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/stl= _uninitialized.h:150:2: note: in instantiation of function template specialization 'std::__uninitialized_copy::__uninit_copy<__gnu_cxx::__normal_iterat= or *, std::vector>>, std::unique_ptr *>' requested here __uninit_copy(__first, __last, __result); ^ /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/stl= _uninitialized.h:325:19: note: in instantiation of function template specialization 'std::uninitialized_copy<__gnu_cxx::__normal_iterator *, std::vector>>, std::unique_ptr *>' requested here { return std::uninitialized_copy(__first, __last, __result); } ^ /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/stl= _vector.h:558:9: note: in instantiation of function template specialization 'std::__uninitialized_copy_a<__gnu_cxx::__normal_iterator *, std::vector>>, std::unique_ptr *, std::unique_ptr>' requested here std::__uninitialized_copy_a(__x.begin(), __x.end(), ^ main.cpp:4:7: note: in instantiation of member function 'std::vector>::vector' requested here class NonCopyable ^ /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/uni= que_ptr.h:468:7: note: 'unique_ptr' has been explicitly marked deleted here unique_ptr(const unique_ptr&) =3D delete; ^ 2 errors generated.=