Summary: | g++ fails to call explicit constructors in the second step of copy initialization | ||
---|---|---|---|
Product: | gcc | Reporter: | Nikolka <tsoae> |
Component: | c++ | Assignee: | Not yet assigned to anyone <unassigned> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | daniel.kruegler |
Priority: | P3 | Keywords: | rejects-valid |
Version: | 4.7.1 | ||
Target Milestone: | 6.0 | ||
Host: | Target: | ||
Build: | Known to work: | ||
Known to fail: | Last reconfirmed: | 2012-09-07 00:00:00 |
Description
Nikolka
2012-09-07 20:38:12 UTC
Works fine with 4.6.3, 4.7.2 20120716 (prerelease) and 4.8.0 20120716 (experimental) As requested when submitting the bug, please provide the information requested at http://gcc.gnu.org/bugs/ including the command line and output of gcc -v (In reply to comment #1) > Works fine with 4.6.3, 4.7.2 20120716 (prerelease) and > 4.8.0 20120716 (experimental) > > As requested when submitting the bug, please provide the information requested > at http://gcc.gnu.org/bugs/ including the command line and output of gcc -v 1) Version info: Target: i686-pc-mingw32 Configured with: ../src/configure --prefix=/c/temp/gcc/dest --with-gmp=/c/temp/gcc/gmp --with-mpfr=/c/temp/gcc/mpfr --with-mpc=/c/temp/gcc/mpc --enable-languages=c,c++ --with-arch=i686 --with-tune=generic --disable-libstdcxx-pch --disable-nls --disable-shared --disable-sjlj-exceptions --disable-win32-registry --enable-checking=release --enable-lto Thread model: win32 gcc version 4.7.1 (GCC) COLLECT_GCC_OPTIONS='-v' '-std=c++11' '-mtune=generic' '-march=i686' c:/common/c++/mingw/mingw-gcc-4.7.1/bin/../libexec/gcc/i686-pc-mingw32/4.7.1/cc1plus.exe -quiet -v -iprefix ..\bin\../lib/gcc/i686-pc-mingw32/4.7.1/ test.cpp -quiet -dumpbase test.cpp -mtune=generic -march=i686 -auxbase test -std=c++11 -version -o GNU C++ (GCC) version 4.7.1 (i686-pc-mingw32) compiled by GNU C version 4.7.1, GMP version 5.0.5, MPFR version 3.1.0-p10, MPC version 0.9 Diagnostic message: test.cpp: In function 'int main()': test.cpp:9:15: error: no matching function for call to 'X::X(X)' test.cpp:9:15: note: candidate is: test.cpp:3:9: note: X::X(int) test.cpp:3:9: note: no known conversion for argument 1 from 'X' to 'int' 2) Version info: Target: i686-pc-linux-gnu Configured with: .../configure --prefix=.../target --enable-languages=c,c++ Thread model: posix gcc version 4.8.0 20120826 (experimental) (GCC) Diagnostic message: test.cpp: In function ‘int main()’: test.cpp:9:15: error: no matching function for call to ‘X::X(X)’ X x = 1; // error: no matching function for call to 'X::X(X)' ^ test.cpp:9:15: note: candidate is: test.cpp:3:9: note: X::X(int) X(int) {} ^ test.cpp:3:9: note: no known conversion for argument 1 from ‘X’ to ‘int’ In both cases (for g++ v4.7.1 and v4.8.0) the only compiler option was -std=c++11. Nothing magical. Thanks, it would be magical if people could guess what options you used, that's why the bug reporting guidelines ask you to provide that information! I must have tested the wrong testcase earlier, I can confirm this fails to compile. *** Bug 63654 has been marked as a duplicate of this bug. *** Mine. Author: paolo Date: Fri Jul 10 22:56:35 2015 New Revision: 225705 URL: https://gcc.gnu.org/viewcvs?rev=225705&root=gcc&view=rev Log: /cp 2015-07-10 Paolo Carlini <paolo.carlini@oracle.com> PR c++/54521 * call.c (convert_like_real): Do not set LOOKUP_ONLYCONVERTING for the second step of copy-initialization. /testsuite 2015-07-10 Paolo Carlini <paolo.carlini@oracle.com> PR c++/54521 * g++.dg/init/explicit3.C: New. Added: trunk/gcc/testsuite/g++.dg/init/explicit3.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/call.c trunk/gcc/testsuite/ChangeLog Fixed for 6.0. |