Bug 18616 – attrib.h:31:7: warning: 'AttribDeclaration' has virtual functions but non-virtual destructor [-Wnon-virtual-dtor]

Status
NEW
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
x86
OS
All
Creation time
2018-03-15T06:00:41Z
Last change time
2024-12-13T18:57:54Z
Assigned to
No Owner
Creator
Timothee Cour
Moved to GitHub: dmd#19411 →

Comments

Comment #0 by timothee.cour2 — 2018-03-15T06:00:41Z
when compiling calypso (but dmd has same issue) i get: ../ddmd/attrib.h:31:7: warning: 'AttribDeclaration' has virtual functions but non-virtual destructor [-Wnon-virtual-dtor] indeed this is what's in src/dmd/attrib.h: it shows virtual functions but non-virtual destructor; * won't that result in memory leaks? * should we add `-Wnon-virtual-dtor` to detect these? * this type of error occurs in lots of places ``` class AttribDeclaration : public Dsymbol { public: Dsymbols *decl; // array of Dsymbol's virtual Dsymbols *include(Scope *sc); int apply(Dsymbol_apply_ft_t fp, void *param); static Scope *createNewScope(Scope *sc, StorageClass newstc, LINK linkage, CPPMANGLE cppmangle, Prot protection, int explicitProtection, AlignDeclaration *aligndecl, PINLINE inlining); virtual Scope *newScope(Scope *sc); void addMember(Scope *sc, ScopeDsymbol *sds); void setScope(Scope *sc); void importAll(Scope *sc); void addComment(const utf8_t *comment); const char *kind() const; bool oneMember(Dsymbol **ps, Identifier *ident); void setFieldOffset(AggregateDeclaration *ad, unsigned *poffset, bool isunion); bool hasPointers(); bool hasStaticCtorOrDtor(); void checkCtorConstInit(); void addLocalClass(ClassDeclarations *); AttribDeclaration *isAttribDeclaration() { return this; } void accept(Visitor *v) { v->visit(this); } }; ```
Comment #1 by robert.schadek — 2024-12-13T18:57:54Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/19411 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB