[LLVMbugs] [Bug 11101] New: constructor taking an rvalue reference causes error with normal copy constructor

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Oct 10 05:32:43 PDT 2011


http://llvm.org/bugs/show_bug.cgi?id=11101

           Summary: constructor taking an rvalue reference causes error
                    with normal copy constructor
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++0x
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: davidhunter22 at gmail.com
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


Trunk code as of revision 141531 on a unmolested Ubuntu Linux desktop.

The following code

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
template<typename T> struct Foo
{   
    explicit Foo(T* );

    Foo(Foo&&) noexcept;
};  

struct Bar
{ 
    virtual ~Bar( ) { }
};

int main( int, char** )
{
    static Foo<Bar> f = Foo<Bar>( new Bar ); 

    Foo<Bar> g = f;
}
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

gives the following error 

bug.cpp:19:14: error: call to deleted constructor of 'Foo<Bar>'
    Foo<Bar> g = f;
             ^   ~
bug.cpp:2:29: note: function has been explicitly marked deleted here
template<typename T> struct Foo 
                            ^
1 error generated.


which seems odd to me. I don't see any function being explicitly marked as
deleted. I assume it means the new " = delete" syntax. I also assume is means
the normal copy constructor Foo(Foo&) which I think should be compiler
generated here although maybe the presence of a "move" constructor is meant to
stop the copy constructor being created.

Anyway this code is a cut down test case from the GCC 4.6.0 header files which
don't seem to have a problem with constructs like this.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list