public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/54521] New: g++ fails to call explicit constructors in the second step of copy initialization
@ 2012-09-07 20:38 tsoae at mail dot ru
  2012-09-07 23:10 ` [Bug c++/54521] " redi at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: tsoae at mail dot ru @ 2012-09-07 20:38 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54521

             Bug #: 54521
           Summary: g++ fails to call explicit constructors in the second
                    step of copy initialization
    Classification: Unclassified
           Product: gcc
           Version: 4.7.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: tsoae@mail.ru


g++ fails to compile the following code

    struct X
    {
        X(int) {}
        explicit X(X const &) {}
    };

    int main()
    {
        X x = 1; // error: no matching function for call to 'X::X(X)'
    }

The second step of a copy initialization (see 8.5/16/6/2) is a
direct-initialization where explicit constructors shall be considered as
candidate functions.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/54521] g++ fails to call explicit constructors in the second step of copy initialization
  2012-09-07 20:38 [Bug c++/54521] New: g++ fails to call explicit constructors in the second step of copy initialization tsoae at mail dot ru
@ 2012-09-07 23:10 ` redi at gcc dot gnu.org
  2012-09-08 12:36 ` tsoae at mail dot ru
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2012-09-07 23:10 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54521

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|                            |2012-09-07
     Ever Confirmed|0                           |1

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-09-07 23:10:27 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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/54521] g++ fails to call explicit constructors in the second step of copy initialization
  2012-09-07 20:38 [Bug c++/54521] New: g++ fails to call explicit constructors in the second step of copy initialization tsoae at mail dot ru
  2012-09-07 23:10 ` [Bug c++/54521] " redi at gcc dot gnu.org
@ 2012-09-08 12:36 ` tsoae at mail dot ru
  2012-09-08 13:25 ` tsoae at mail dot ru
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: tsoae at mail dot ru @ 2012-09-08 12:36 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54521

--- Comment #2 from Nikolka <tsoae at mail dot ru> 2012-09-08 12:36:29 UTC ---
(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’


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/54521] g++ fails to call explicit constructors in the second step of copy initialization
  2012-09-07 20:38 [Bug c++/54521] New: g++ fails to call explicit constructors in the second step of copy initialization tsoae at mail dot ru
  2012-09-07 23:10 ` [Bug c++/54521] " redi at gcc dot gnu.org
  2012-09-08 12:36 ` tsoae at mail dot ru
@ 2012-09-08 13:25 ` tsoae at mail dot ru
  2012-09-09  0:30 ` redi at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: tsoae at mail dot ru @ 2012-09-08 13:25 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54521

--- Comment #3 from Nikolka <tsoae at mail dot ru> 2012-09-08 13:25:20 UTC ---
In both cases (for g++ v4.7.1 and v4.8.0) the only compiler option was
-std=c++11. Nothing magical.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/54521] g++ fails to call explicit constructors in the second step of copy initialization
  2012-09-07 20:38 [Bug c++/54521] New: g++ fails to call explicit constructors in the second step of copy initialization tsoae at mail dot ru
                   ` (2 preceding siblings ...)
  2012-09-08 13:25 ` tsoae at mail dot ru
@ 2012-09-09  0:30 ` redi at gcc dot gnu.org
  2014-10-27  9:58 ` redi at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2012-09-09  0:30 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54521

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-09-09 00:29:45 UTC ---
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.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/54521] g++ fails to call explicit constructors in the second step of copy initialization
  2012-09-07 20:38 [Bug c++/54521] New: g++ fails to call explicit constructors in the second step of copy initialization tsoae at mail dot ru
                   ` (3 preceding siblings ...)
  2012-09-09  0:30 ` redi at gcc dot gnu.org
@ 2014-10-27  9:58 ` redi at gcc dot gnu.org
  2015-07-10 22:57 ` paolo at gcc dot gnu.org
  2015-07-10 22:58 ` paolo.carlini at oracle dot com
  6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2014-10-27  9:58 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54521

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kariya_mitsuru at hotmail dot com

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
*** Bug 63654 has been marked as a duplicate of this bug. ***


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/54521] g++ fails to call explicit constructors in the second step of copy initialization
  2012-09-07 20:38 [Bug c++/54521] New: g++ fails to call explicit constructors in the second step of copy initialization tsoae at mail dot ru
                   ` (4 preceding siblings ...)
  2014-10-27  9:58 ` redi at gcc dot gnu.org
@ 2015-07-10 22:57 ` paolo at gcc dot gnu.org
  2015-07-10 22:58 ` paolo.carlini at oracle dot com
  6 siblings, 0 replies; 8+ messages in thread
From: paolo at gcc dot gnu.org @ 2015-07-10 22:57 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54521

--- Comment #7 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> ---
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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/54521] g++ fails to call explicit constructors in the second step of copy initialization
  2012-09-07 20:38 [Bug c++/54521] New: g++ fails to call explicit constructors in the second step of copy initialization tsoae at mail dot ru
                   ` (5 preceding siblings ...)
  2015-07-10 22:57 ` paolo at gcc dot gnu.org
@ 2015-07-10 22:58 ` paolo.carlini at oracle dot com
  6 siblings, 0 replies; 8+ messages in thread
From: paolo.carlini at oracle dot com @ 2015-07-10 22:58 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54521

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED
           Assignee|paolo.carlini at oracle dot com    |unassigned at gcc dot gnu.org
   Target Milestone|---                         |6.0

--- Comment #8 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Fixed for 6.0.


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-07-10 22:58 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-07 20:38 [Bug c++/54521] New: g++ fails to call explicit constructors in the second step of copy initialization tsoae at mail dot ru
2012-09-07 23:10 ` [Bug c++/54521] " redi at gcc dot gnu.org
2012-09-08 12:36 ` tsoae at mail dot ru
2012-09-08 13:25 ` tsoae at mail dot ru
2012-09-09  0:30 ` redi at gcc dot gnu.org
2014-10-27  9:58 ` redi at gcc dot gnu.org
2015-07-10 22:57 ` paolo at gcc dot gnu.org
2015-07-10 22:58 ` paolo.carlini at oracle dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).