I cannot replicate this problem in a smaller program that I can show so I will illustrate the question with screenshots.
I have a class that declares a union and a static member of the union:
class
{
/* rest of the class */
union EmptyString
{
char8 m_Empty8[1];
uchar8 m_EmptyU8[1];
char32 m_Empty32[1];
};
static const EmptyString sm_emptyString;
};
// Definition
template <typename T>
const typename StringBase<T>::EmptyString
StringBase<T>::sm_emptyString = { 0 };
I then have a function that returns the address of the string. For debugging purposes, I have added the variable address so that I can add it to the watch window. Here is the function (T here is a char8 where char8 is a typedef for char):
template <typename T>
const char8* StringBase<T>::GetEmptyString( char8 )
{
const char8* address = sm_emptyString.m_Empty8;
//const char8* address = &(sm_emptyString.m_Empty8[0]);
return address;
//return sm_emptyString.m_Empty8;
}
As you can see, initially I had the one return statement, which I commented out so that I can debug the snippet. The other line that is commented out is taking the address of the first (and only) element of the array; this commented out line does the same thing as the line previous to it, which is: const char8* address = sm_emptyString.m_Empty8;.
The program crashes because I am not getting the correct address by the above function and this has stumped me. Below I will start screenshots of my debugging session:

Above, you can see that I am breaking just before the address is copied to the pointer. Below is the watch window values for sm_emptyString and address<