2025-08-15 20:37 CEST

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0004937Spring engineGeneralpublic2017-05-03 00:43
Reporterabma 
Assigned To 
PrioritynormalSeveritymajorReproducibilityhave not tried
StatusclosedResolutionfixed 
Product Version100.0+git 
Target VersionFixed in Version103.0 +git 
Summary0004937: compile error: 'AAirMoveType': cannot instantiate abstract class
DescriptionC:\Users\Alex\Desktop\spring\rts\Sim\MoveTypes\AAirMoveType.cpp(15): error C2259: 'AAirMoveType': cannot instantiate abstract class
C:\Users\Alex\Desktop\spring\rts\Sim\MoveTypes\AAirMoveType.cpp(15): note: due to following members:
C:\Users\Alex\Desktop\spring\rts\Sim\MoveTypes\AAirMoveType.cpp(15): note: 'void AMoveType::StartMoving(float3,float,float)': is abstract
c:\users\alex\desktop\spring\rts\sim\movetypes\MoveType.h(23): note: see declaration of 'AMoveType::StartMoving'
C:\Users\Alex\Desktop\spring\rts\Sim\MoveTypes\AAirMoveType.cpp(15): note: 'void AMoveType::StartMoving(float3,float)': is abstract
c:\users\alex\desktop\spring\rts\sim\movetypes\MoveType.h(22): note: see declaration of 'AMoveType::StartMoving'
C:\Users\Alex\Desktop\spring\rts\Sim\MoveTypes\AAirMoveType.cpp(15): note: 'void AMoveType::KeepPointingTo(float3,float,bool)': is abstract
c:\users\alex\desktop\spring\rts\sim\movetypes\MoveType.h(24): note: see declaration of 'AMoveType::KeepPointingTo'
C:\Users\Alex\Desktop\spring\rts\Sim\MoveTypes\AAirMoveType.cpp(15): note: 'void AMoveType::StopMoving(bool,bool)': is abstract
c:\users\alex\desktop\spring\rts\sim\movetypes\MoveType.h(26): note: see declaration of 'AMoveType::StopMoving'
clang-cl.exe: error: clang frontend command failed with exit code 2 (use -v to see invocation)
TagsNo tags attached.
Checked infolog.txt for Errors
Attached Files

-Relationships
+Relationships

-Notes

~0015093

abma (administrator)

backlink: https://springrts.com/phpbb/viewtopic.php?p=572742#p572742

~0015094

Kloot (developer)

Last edited: 2015-08-26 17:28

View 2 revisions

CR_DECLARE(TCls=AAirMoveType) expands to

    static creg::ClassBinder binder;
    typedef TCls MyType;
    static creg::IMemberRegistrator* memberRegistrator;
    static void _ConstructInstance(void* d);
    static void _DestructInstance(void* d);
    friend struct TCls##MemberRegistrator;
    inline static creg::Class* StaticClass() { return binder.class_; }
    virtual creg::Class* GetClass() const;
    static bool creg_hasVTable;
    static const bool creg_isStruct = false;


CR_BIND_DERIVED_INTERFACE(TCls=AAirMoveType, TBase=AMoveType) expands to

    bool TCls::creg_hasVTable = std::is_polymorphic<TCls>::value;
    creg::IMemberRegistrator* TCls::memberRegistrator=0;
    creg::Class* TCls::GetClass() const { return binder.class_; }
    creg::ClassBinder TCls::binder(#TCls, (unsigned int)creg::CF_Abstract, &TBase::binder, &TCls::memberRegistrator, sizeof(TCls), alignof(TCls), TCls::creg_hasVTable, TCls::creg_isStruct, 0, 0);


TCls::GetClass is an instance member which should not be possible to call for abstract classes, so I wonder why the CR_BIND_DERIVED_INTERFACE macro adds a definition for it.

~0015095

abma (administrator)

isn't the error saying AMoveType::StartMoving(float3,float,float) needs to be implemented?

https://github.com/spring/spring/blob/develop/rts/Sim/MoveTypes/MoveType.h#L23

~0015096

Kloot (developer)

It shouldn't need to be: AMoveType and AAirMoveType are both abstract and never instantiated (except clang seems to think AAirMoveType is, through CR_BIND_DERIVED_INTERFACE).

Try manually expanding https://github.com/spring/spring/blob/develop/rts/Sim/MoveTypes/AAirMoveType.cpp#L15 and see which line of the macro triggers the error.

~0015103

super mario (reporter)

This line of code is giving the me the errors

creg::ClassBinder TCls::binder(#TCls, (unsigned int)creg::CF_Abstract, &TBase::binder, &TCls::memberRegistrator, sizeof(TCls), alignof(TCls), TCls::creg_hasVTable, TCls::creg_isStruct, 0, 0);

The error also appears on the mingw compiler.

~0017553

Kloot (developer)

clang build seems fine now, just 8000 warnings left.
+Notes

-Issue History
Date Modified Username Field Change
2015-08-26 15:42 abma New Issue
2015-08-26 15:42 abma Note Added: 0015093
2015-08-26 17:27 Kloot Note Added: 0015094
2015-08-26 17:28 Kloot Note Edited: 0015094 View Revisions
2015-08-26 18:43 abma Note Added: 0015095
2015-08-26 19:33 Kloot Note Added: 0015096
2015-08-29 18:12 super mario Note Added: 0015103
2015-09-17 11:39 abma Target Version 101.0 =>
2017-05-03 00:43 Kloot Status new => closed
2017-05-03 00:43 Kloot Resolution open => fixed
2017-05-03 00:43 Kloot Fixed in Version => 103.0 +git
2017-05-03 00:43 Kloot Note Added: 0017553
+Issue History