public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/54510] New: If Move constructor is templatized then, that version is invoked instead default move
@ 2012-09-06 20:20 rsdevgun at gmail dot com
  2012-09-07  5:40 ` [Bug c++/54510] " daniel.kruegler at googlemail dot com
  2012-09-07  9:20 ` paolo.carlini at oracle dot com
  0 siblings, 2 replies; 3+ messages in thread
From: rsdevgun at gmail dot com @ 2012-09-06 20:20 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 54510
           Summary: If Move constructor is templatized then, that version
                    is invoked instead default move
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: rsdevgun@gmail.com


#include <iostream>
#include <string>

using namespace std;
// uncomment to see the bug with 4.7.1 and 4.8.0
#define _BUG_

struct Test
{
  Test() = default;
  Test(const Test & )
  {
    cout << "ctor overload 1 & " << endl;
  }

  #ifdef _BUG_

  template<typename T>
  Test(T && )
  {
    //T* t = "0"; // For intentional error
    cout << "ctor template version overload 2 && " << endl;
  }

  #else
  Test(Test && )
  {
    cout << "ctor specialized overload 2 && " << endl;
  }

  #endif
 };



int main()
{
  Test t1( []()-> Test { return Test();}() );

  return 0;
}








I expect Test(Test && ) to be invokved (without template version).

Also if you uncommment //T* t = "0"; -> you will see that data type is not a
magical data type, Being same as class itself, behavior is wrong.


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

* [Bug c++/54510] If Move constructor is templatized then, that version is invoked instead default move
  2012-09-06 20:20 [Bug c++/54510] New: If Move constructor is templatized then, that version is invoked instead default move rsdevgun at gmail dot com
@ 2012-09-07  5:40 ` daniel.kruegler at googlemail dot com
  2012-09-07  9:20 ` paolo.carlini at oracle dot com
  1 sibling, 0 replies; 3+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2012-09-07  5:40 UTC (permalink / raw)
  To: gcc-bugs

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

Daniel Krügler <daniel.kruegler at googlemail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |daniel.kruegler at
                   |                            |googlemail dot com

--- Comment #1 from Daniel Krügler <daniel.kruegler at googlemail dot com> 2012-09-07 05:40:24 UTC ---
This bug report looks invalid to me for the same reason as bug 54510


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

* [Bug c++/54510] If Move constructor is templatized then, that version is invoked instead default move
  2012-09-06 20:20 [Bug c++/54510] New: If Move constructor is templatized then, that version is invoked instead default move rsdevgun at gmail dot com
  2012-09-07  5:40 ` [Bug c++/54510] " daniel.kruegler at googlemail dot com
@ 2012-09-07  9:20 ` paolo.carlini at oracle dot com
  1 sibling, 0 replies; 3+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-09-07  9:20 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID

--- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-09-07 09:19:49 UTC ---
Closing.


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

end of thread, other threads:[~2012-09-07  9:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-06 20:20 [Bug c++/54510] New: If Move constructor is templatized then, that version is invoked instead default move rsdevgun at gmail dot com
2012-09-07  5:40 ` [Bug c++/54510] " daniel.kruegler at googlemail dot com
2012-09-07  9:20 ` 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).