Path: csiph.com!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail From: johnny dude Newsgroups: gnu.utils.bug Subject: Bug in the linker Date: Wed, 21 Aug 2019 14:59:15 +0300 Lines: 27 Approved: bug-gnu-utils@gnu.org Message-ID: References: NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" X-Trace: usenet.stanford.edu 1566395340 18576 209.51.188.17 (21 Aug 2019 13:49:00 GMT) X-Complaints-To: action@cs.stanford.edu To: bug-gnu-utils@gnu.org Envelope-to: bug-gnu-utils@gnu.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=1r4EtL4Fuj9h2WIlLeAw7rgELrAuh4NxAIHACIFRsXw=; b=eSDK/G5E6+2vSpbYDQXKOPtnblh4bgdUEeHUGotxBkJLK2B3gEQMdW86NPYBXHue+P ozfQ02nVxZ17LD1QjjNOibvpbIVrQGb+RPoGAmbEoxBXvE+MCDuL0eGoQfOGa1jP+yil bnxXL1YVuls1SzfiU7FplYUW4bcmmYWdAmcmnZkysl0VN1vM6bncSsoqSZ83zORe4376 Ii7/rcCba9yxY1vIxERd3bvB2dUjPA8UZ+bQxJwTqGclTqjIYxBlKK7y3Eka7zlx9JkA nzW7ynX3t5h52j8NtJ5i5xH5BAnE/g534VA+/SG4c4Yt4x099pDd/Q8whshjmAH+31Sl VL1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=1r4EtL4Fuj9h2WIlLeAw7rgELrAuh4NxAIHACIFRsXw=; b=GIArbuKbMYVeQTBW8gZk5O9bXeNac/q/4GXDEMqpAWdN+FNU84MDMT6O19DdoZcToI VpIiivHarOSqkedJn7zA1sMItBTXLoPGJRXsxRykPSiwj11CC2SrO6ILUcJBlgkEgC0B 2Ul6ISHg1t/uI88QTWKa440EYiEqBmL7Bh031ba7rfKw8Nw30fgc8ZAqAXdfPGKzOtLu +F3TjJp1yscDTAgmuiZ1d54rHkz2PHMzwZtpFvu6ZM52IxxIIQ7CvkWP07eCrJ8A+qr0 CnEZEVYU5cWnHjSG6s+jeNjRmOzFNR2eUuIJmcnaiTiRv7V4PH82pQefXIt2VRSerzp+ MS9w== X-Gm-Message-State: APjAAAWcA+Qyd4/v5zMiG5FksPYi7tPkSV+vXBhuyff32BLrII4yvf7g Xhc4IHzRYdP980GeHeEuvlEovxlKMplDPGi6zvvIdA== X-Google-Smtp-Source: APXvYqy2XQgKM+z+nmj90CzZD/5QZNwFSu1KWKd60EDg+u1tlQd3lVtH86E0zu0p9jHzxewPs4hc3Pq3Oa1W+rjPqbA= X-Received: by 2002:a19:6753:: with SMTP id e19mr18594201lfj.187.1566388764044; Wed, 21 Aug 2019 04:59:24 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::12a X-Mailman-Approved-At: Wed, 21 Aug 2019 09:48:59 -0400 X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: bug-gnu-utils@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Bug reports for the GNU utilities List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: Xref: csiph.com gnu.utils.bug:2264 Hi, I found a possible bug, ld does not produce an error message: "multiple definitions" when it is a constructor defined in the structure declaration. How to reproduce it: I'm using the gcc:9.2.0 docker, created two files and the result listed below: root@44027fc60f45:/# cat a.cpp #include struct A { int n; A(int n) : n(n + 10) {} }; int a(int n) { return A(n).n; } extern int b(int n); int main(int, char**) { std::clog << a(5) << ", " << b(5) << "\n"; } root@44027fc60f45:/# cat b.cpp #include struct A { int n; A(int n) : n(n + 100) {} }; int b(int n) { return A(n).n; } root@44027fc60f45:/# g++ a.cpp b.cpp -o ab && ./ab 15, 15 root@44027fc60f45:/# g++ b.cpp a.cpp -o ba && ./ba 105, 105 root@44027fc60f45:/#