Bug 23339 – Internal Compiler Error with extern(C++) class declared in function template

Status
NEW
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
Linux
Creation time
2022-09-17T10:29:00Z
Last change time
2024-12-13T19:24:29Z
Assigned to
No Owner
Creator
naydef
Moved to GitHub: dmd#20149 →

Comments

Comment #0 by naydef — 2022-09-17T10:29:00Z
Code: ---------------------------------- auto HookVFunc(T)(T) { extern(C++) class Delegate { void dd() {} } } class SamplePlugin { void Load() { HookVFunc(&GameFrame); } void GameFrame() { } } ---------------------------------- Error: source/app.d(5,14): Error: Internal Compiler Error: type `void delegate()` cannot be mapped to C++ ---------------------------------- I'm not very sure if this is supposed to be a valid code(I think it is.) Marked as regression, because run.dlang.io indicates compile success up to DMD 2.65.0
Comment #1 by naydef — 2022-09-17T12:40:09Z
Adding 'static' to class Delegate does not change anything(suggested by Adam) ------------------------------------------------- auto HookVFunc(T)(T) { extern(C++) static class Delegate { void dd() {} } } class SamplePlugin { void Load() { HookVFunc(&GameFrame); } void GameFrame() { } }
Comment #2 by naydef — 2022-09-17T12:41:10Z
Adding 'static' to class Delegate does not change anything(suggested by Adam) ------------------------------------------------- auto HookVFunc(T)(T) { extern(C++) static class Delegate { void dd() {} } } class SamplePlugin { void Load() { HookVFunc(&GameFrame); } void GameFrame() { } }
Comment #3 by naydef — 2022-09-17T12:43:26Z
Adding 'static' to class Delegate does not change anything(suggested by Adam) ------------------------------------------------- auto HookVFunc(T)(T) { extern(C++) static class Delegate { void dd() {} } } class SamplePlugin { void Load() { HookVFunc(&GameFrame); } void GameFrame() { } }
Comment #4 by naydef — 2022-09-18T13:53:15Z
Sorry for the comment spam Another example caused by the same issue, probably: ----------------------------------------------- import std.stdio; import std.traits; extern(C++) class Delegate(string Linkage) { void opCall() { string myString = Linkage; } } void main() { auto special = new Delegate!("C"); } ----------------------------------------------- onlineapp.d(14): Error: template instance `onlineapp.Delegate!"C"` Internal Compiler Error: C++ `string` template value parameter is not supported -----------------------------------------------
Comment #5 by robert.schadek — 2024-12-13T19:24:29Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/20149 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB