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

             Bug #: 52755
           Summary: Error on use of implicitly deleted operator=
    Classification: Unclassified
           Product: gcc
           Version: 4.6.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: holger.h...@sap.com


Following code compiles fine with every gcc, with every g++ -std=c++98, 
with g++-4.5 -std=c++0x, but not with g++ -std=c++0x (or -std=c++11) since 4.6.

typedef volatile struct t1s { int a; } t1;
typedef struct t2s { t1 b; } t2;
t2 x, y;

void foo(void)
{
  x = y;
}

compile with: g++ -std=c++0x vola.cpp

vola.cpp: In function 'void foo()':
vola.cpp:7:7: error: use of deleted function 't2s& t2s::operator=(const t2s&)'
vola.cpp:2:16: error: 't2s& t2s::operator=(const t2s&)' is implicitly deleted
because the default definition would be ill-formed:
vola.cpp:2:16: error: no matching function for call to 't1s::operator=(const
volatile t1&) volatile'
vola.cpp:2:16: note: candidates are:
vola.cpp:1:25: note: t1s& t1s::operator=(const t1s&)
vola.cpp:1:25: note:   no known conversion for argument 1 from 'const volatile
t1' to 'const t1s&'
vola.cpp:1:25: note: t1s& t1s::operator=(t1s&&)
vola.cpp:1:25: note:   no known conversion for argument 1 from 'const volatile
t1' to 't1s&&'

Reply via email to