From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id EAD8E3858C36; Sat, 12 Aug 2023 19:19:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EAD8E3858C36 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1691867988; bh=wlKnoWVtlYa4pZSb5IUqjXCQkgzv5Rvqv57NVmsPt/w=; h=From:To:Subject:Date:From; b=dOGpVT6/C09wZcdnmWpqc0NaO/PaF3a6JaoSNZWJJ1lCWZVj78DXITxTMtw3gI42G qmx0VoOnAo7Hxksg8Xn0c6P4M/14wut28RM/wO6yMWfFM4YK67Jx36Bpb5tw+HuUAe lsU/OcYE7NpF4nIacTvlEPt4ysj2rC/Z210zFNtk= From: "deco33000 at yandex dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/111004] New: Visitor and concept error message Date: Sat, 12 Aug 2023 19:19:48 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 13.2.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: deco33000 at yandex dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: 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=3D111004 Bug ID: 111004 Summary: Visitor and concept error message Product: gcc Version: 13.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: deco33000 at yandex dot com Target Milestone: --- The error code for the following situation is not clear. The error is that struct A and B don't have a "bool activated;" member. The issue is the variant does not reflect what the error is in an helpful w= ay. To ease your life, here is the godbolt: https://godbolt.org/z/Wdr4zn5E1 Do you think it is possible to improve the diagnostic? --------------------------- Reduced test case: #include #include #include using namespace std; template concept My_concept =3D requires(T a) { { a.activated } -> std::same_as; }; struct A { bool not_activated; }; struct B { bool not_activated; int other; }; auto test(variant &v) -> void { std::visit([](My_concept auto &&arg) { std::cout << "OK\n"; }, v); } int main() { variant v; v =3D A(); test(v); return 0; } ------------------------ Thanks=