[LLVMbugs] [Bug 12575] New: attempt to call explicitly-defaulted copy ctor without reasons

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Apr 17 08:15:56 PDT 2012


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

             Bug #: 12575
           Summary: attempt to call explicitly-defaulted copy ctor without
                    reasons
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: abominable-snowman at yandex.ru
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


cat > test.cc <<EOF
struct movable
{
  movable() :
      f( 0 )
    { }

  movable( movable&& r ) :
      f(0)
    { }

  movable( const movable& ) = delete;

  int f;
};

template <class T1, class T2>
struct pair
{
  pair( const pair& ) = default;
  pair( pair&& ) = default;

  constexpr pair()
    { }

  T1 first;
  T2 second;
};

void f()
{
  pair<int,movable> p0;
}

EOF

clang++ -std=gnu++0x -c test.cc
test.cc:19:3: error: the parameter for this explicitly-defaulted copy
constructor is const, but a member or
      base requires it to be non-const
  pair( const pair& ) = default;
  ^
test.cc:31:21: note: in instantiation of template class 'pair<int, movable>'
requested here
  pair<int,movable> p0;
                    ^
1 error generated.

first and second are default contructible here. Copy ctor for pair not
instantiated here, IMO.

-- 
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