Anonymous | Login | 2022-05-27 19:03 UTC | ![]() |
My View | View Issues | Change Log | Roadmap |
View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] | ||||||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||||||
0001012 | OMNeT++ | command line tools | public | 2017-05-04 23:21 | 2017-05-04 23:21 | ||||||||
Reporter | paolinux | ||||||||||||
Assigned To | |||||||||||||
Priority | normal | Severity | minor | Reproducibility | always | ||||||||
Status | new | Resolution | open | ||||||||||
Platform | x86 | OS | Windows | OS Version | 10 | ||||||||
Product Version | 5.1 | ||||||||||||
Target Version | Fixed in Version | ||||||||||||
Summary | 0001012: nedtool produces the wrong code for auto-generated classes | ||||||||||||
Description | The following code in a .msg file class Foo { int a = 0; } class Bar extends Foo { int b = 42; } generates the correct code. However, if I split the declaration in two separate files #File1.msg class Foo { int a = 0; } #File2.msg cplusplus {{ #include "File1_m.h" }} class Foo; class Bar extends Foo { int b = 42; } the generated code does not compile any longer. | ||||||||||||
Steps To Reproduce | #DynaPacket.msg enum DynaPacketType { DYNA_CONN_REQ = 0; DYNA_CONN_ACK = 1; DYNA_DISC_REQ = 2; DYNA_DISC_ACK = 3; DYNA_DATA = 4; }; packet DynaPacket { int srcAddress; int destAddress; int serverProcId; string displayString = "i=msg/package_s,kind"; }; packet DynaDataPacket extends DynaPacket { string payload; }; class Foo { int a = 0; } #Foobar.msg cplusplus {{ #include "DynaPacket_m.h" }} class Foo; class Bar extends Foo { int b = 42; } | ||||||||||||
Additional Information | The issue is that if the two classes are declarated in the same file the following code is generated Bar::Bar() : ::Foo() { this->b = 42; } Instead, if the classes are declared in separate files, the following (buggy) code is generated: Bar::Bar(const char *name) : ::Foo(name) { this->b = 42; } which fails with the following error because Foo does not define a constructor that takes a const char* Foobar_m.cc: In constructor 'Bar::Bar(const char*)': Foobar_m.cc:182:40: error: no matching function for call to 'Foo::Foo(const char*&)' Bar::Bar(const char *name) : ::Foo(name) ^ In file included from Foobar_m.h:22:0, from Foobar_m.cc:29: DynaPacket_m.h:155:5: note: candidate: Foo::Foo(const Foo&) Foo(const Foo& other); ^~~ DynaPacket_m.h:155:5: note: no known conversion for argument 1 from 'const char*' to 'const Foo&' DynaPacket_m.h:154:5: note: candidate: Foo::Foo() Foo(); ^~~ DynaPacket_m.h:154:5: note: candidate expects 0 arguments, 1 provided make: *** [Makefile:105: out/gcc-debug//Foobar_m.o] Error 1 | ||||||||||||
Tags | No tags attached. | ||||||||||||
Attached Files | |||||||||||||
![]() |
|||
Date Modified | Username | Field | Change |
2017-05-04 23:21 | paolinux | New Issue |
Copyright © 2000 - 2022 MantisBT Team |