This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Compiler/AM3352: Compiler error when trying to copy a 'union' variable

Part Number: AM3352

Tool/software: TI C/C++ Compiler

After upgrading to TI Compiler 18.1.0.LTS, I'm unable to perform a simple assignment of a variable that happens to be a 'union'.  The error reported is:

function "SOME_CONTROL_REGISTER::operator=(const SOME_CONTROL_REGISTER &)" (declared implicitly) cannot be referenced -- it is a deleted function 

The Google references to this type of error have not produced something that appears to be similar to what I'm doing.  

The work around is to assign to one of the elements of the union instead.  The below code works with a much older compiler (Version 5.0).  I've highlighted two variable assignments (i.e. 'offending' code that produces the compiler error and 'work around' code that does not).  I haven't gone through to see at which version of the compiler this error started getting reported.

If the code below is put into a File.c file, it compiles without complaint.  If the code is put into a File.cpp file, the error is reported.

Which of the following is true?

1. Compiler version 5.0 incorrectly did not flag the offending line of code, I was getting lucky.

2. Compiler version 18.1 is incorrectly flagging the offending line of code, the compiler has a problem

3. Between version 5.0 and 18.1 the C++ standard itself changed that made what used to be working code, no longer valid.

If either 1 or 3 is true, can you reference the wording in the C++ standard that explains this?  I thought one could always perform a simple assignment of any type of variable.

Kevin Jennings

--- Start of code ---

typedef union
{
volatile unsigned int reg;
volatile struct
{
unsigned int Field1:13;
unsigned int Field2:2;
unsigned int Field3:2;
unsigned int Field4:8;
unsigned int Field5:1;
unsigned int Field6:5;
unsigned int Field7:1;
} bit;
}SOME_CONTROL_REGISTER;

void Sample(void)
{
const SOME_CONTROL_REGISTER ConstControlReg = {0};
SOME_CONTROL_REGISTER MyControlReg;
MyControlReg = ConstControlReg; // This error is reported --> function "SOME_CONTROL_REGISTER::operator=(const SOME_CONTROL_REGISTER &)" (declared implicitly) cannot be referenced -- it is a deleted function Redmine1552.cpp /SmartSourceElite_Pro2/applications line 21 C/C++ Problem
MyControlReg.reg = ConstControlReg.reg; // This works.
}

--- End of code ---