mirror of
https://github.com/1dot13/source.git
synced 2026-07-29 13:52:17 +02:00
declare the table specialisations before anything instantiates one
TestTableTemplate declares SetRefresh and Init but never defines them; both exist only as explicit specialisations, one set per table, at the bottom of FacilityProduction.cpp and MilitiaWebsite.cpp. That is too late for tables 3 and 4. Both files call SetRefresh on their table hundreds of lines above the specialisation, and a call is a point of instantiation, so the compiler has already committed to instantiating the primary template by the time the specialisation shows up. A specialisation declared after the first use that would instantiate it is ill-formed; MSVC takes it anyway, clang-cl reports error: explicit specialization of 'SetRefresh' after instantiation Declaring the specialisations after the includes fixes it. Tables 1 and 2 are only ever reached through the base class pointer, so they were not diagnosed, but they are declared alongside the others rather than left to depend on that. The definitions stay where they are.
This commit is contained in:
committed by
majcosta
parent
6d2df6addc
commit
3cc3ade169
@@ -18,6 +18,11 @@
|
||||
#include "strategic.h"
|
||||
#include "BaseTable.h"
|
||||
|
||||
// Every member below is specialised for each table, and nothing else defines them.
|
||||
// The specialisations have to be visible before the first use instantiates one.
|
||||
template<> void TestTableTemplate<4>::SetRefresh();
|
||||
template<> void TestTableTemplate<4>::Init( UINT16 sX, UINT16 sY, UINT16 sX_End, UINT16 sY_End );
|
||||
|
||||
/*#define MERCOMP_FONT_COLOR 2
|
||||
#define CAMPHIS_FONT_BIG FONT14ARIAL
|
||||
#define CAMPHIS_FONT_MED FONT12ARIAL
|
||||
|
||||
@@ -46,6 +46,15 @@
|
||||
#include "InterfaceItemImages.h"
|
||||
#include "CampaignStats.h"
|
||||
|
||||
// Every member below is specialised for each table, and nothing else defines them.
|
||||
// The specialisations have to be visible before the first use instantiates one.
|
||||
template<> void TestTableTemplate<1>::SetRefresh();
|
||||
template<> void TestTableTemplate<1>::Init( UINT16 sX, UINT16 sY, UINT16 sX_End, UINT16 sY_End );
|
||||
template<> void TestTableTemplate<2>::SetRefresh();
|
||||
template<> void TestTableTemplate<2>::Init( UINT16 sX, UINT16 sY, UINT16 sX_End, UINT16 sY_End );
|
||||
template<> void TestTableTemplate<3>::SetRefresh();
|
||||
template<> void TestTableTemplate<3>::Init( UINT16 sX, UINT16 sY, UINT16 sX_End, UINT16 sY_End );
|
||||
|
||||
|
||||
#define MERCOMP_FONT_COLOR 2
|
||||
#define CAMPHIS_FONT_COLOR_RED FONT_MCOLOR_RED
|
||||
|
||||
Reference in New Issue
Block a user