From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C431A3858C50; Wed, 10 Jan 2024 02:53:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C431A3858C50 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1704855210; bh=ak5F9Oh0jFwiZbgyGRdd8+snBXT5jBBjYHygw5qfDCc=; h=From:To:Subject:Date:From; b=LnnPoSke4Y/SZmmMsjG7GNhiZFQttwl+QL5OhB+rKncRgquDDweC8/xeGq4VnUZKC 6xLBAW9BEanqq1vt/R5dZt01b5/Jqq1260xLAKiKF+FQdyw3ioYYCi0hICLSwawozA HlJSWZuWPHyk0dTLkR5gEmLQ2hO58IP5Lpe67/Ro= From: "jlame646 at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/113300] New: GCC rejects valid program involving explicit and non explicit default constructors Date: Wed, 10 Jan 2024 02:53:30 +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: 14.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jlame646 at gmail 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=3D113300 Bug ID: 113300 Summary: GCC rejects valid program involving explicit and non explicit default constructors Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: jlame646 at gmail dot com Target Milestone: --- The following valid program is rejected by gcc and clang but accepted by ms= vc. https://godbolt.org/z/Y3x8nP11M ``` struct A { explicit A(int =3D 10); A()=3D default; }; A a =3D {}; //msvc ok but gcc and clang fails here ``` GCC says: ``` :8:8: error: conversion from '' to= 'A' is ambiguous 8 | A a =3D {}; //msvc ok but gcc and clang fails here | ^ :5:3: note: candidate: 'constexpr A::A()' 5 | A()=3D default; | ^ :4:12: note: candidate: 'A::A(int)' 4 | explicit A(int =3D 10); ``` The reason why this is valid is discussed here: https://stackoverflow.com/questions/77788861/ambiguous-constructor-error-in= -gcc-but-not-in-msvc=