Skip to content

Commit 118a0d5

Browse files
author
Bart Roossien
committed
[ZH] Fix compiler warnings for uninitialised variables in copy constructors (TheSuperHackers#534)
1 parent 44abb48 commit 118a0d5

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h

+6-1
Original file line numberDiff line numberDiff line change
@@ -531,9 +531,14 @@ class GlobalData : public SubsystemInterface
531531
GlobalData *newOverride( void ); /** create a new override, copy data from previous
532532
override, and return it */
533533

534-
534+
// TheSuperHackers @compilerwarning fix Mauller 28/03/2025 incomplete copy constructors causing uninitialised variable warnings in compilation.
535+
#if defined(_MSC_VER) && _MSC_VER < 1300
535536
GlobalData(const GlobalData& that) { DEBUG_CRASH(("unimplemented")); }
536537
GlobalData& operator=(const GlobalData& that) { DEBUG_CRASH(("unimplemented")); return *this; }
538+
#else
539+
GlobalData(const GlobalData& that) = delete;
540+
GlobalData& operator=(const GlobalData& that) = default; //Copy constructor is actually used by the new override function.
541+
#endif
537542

538543
};
539544

GeneralsMD/Code/GameEngine/Include/Common/ThingTemplate.h

+6
Original file line numberDiff line numberDiff line change
@@ -351,10 +351,16 @@ class ThingTemplate : public Overridable
351351
MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE(ThingTemplate, "ThingTemplatePool" )
352352

353353
private:
354+
355+
// TheSuperHackers @compilerwarning fix Mauller 28/03/2025 incomplete copy constructors causing uninitialised variable warnings in compilation.
356+
#if defined(_MSC_VER) && _MSC_VER < 1300
354357
ThingTemplate(const ThingTemplate& that) : m_geometryInfo(that.m_geometryInfo)
355358
{
356359
DEBUG_CRASH(("This should never be called\n"));
357360
}
361+
#else
362+
ThingTemplate(const ThingTemplate& that) = delete;
363+
#endif
358364

359365
public:
360366

GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -1129,6 +1129,7 @@ Bool GlobalData::setTimeOfDay( TimeOfDay tod )
11291129
//-------------------------------------------------------------------------------------------------
11301130
GlobalData *GlobalData::newOverride( void )
11311131
{
1132+
// TheSuperHackers @info This copy is not implemented in VS6 builds
11321133
GlobalData *override = NEW GlobalData;
11331134

11341135
// copy the data from the latest override (TheWritableGlobalData) to the newly created instance

0 commit comments

Comments
 (0)