Bug 21304 – dtoh silently ignore default parameters, leading to invalid headers

Status
RESOLVED
Resolution
FIXED
Severity
blocker
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2020-10-11T10:37:35Z
Last change time
2020-10-14T18:00:56Z
Keywords
C++
Assigned to
No Owner
Creator
Mathias LANG

Comments

Comment #0 by pro.mathias.lang — 2020-10-11T10:37:35Z
The following code: ``` extern(C++): struct Bar { int a; } void fooBar (int a = 42, Bar b = Bar.init) {} ``` Will lead to the following header: ``` // Automatically generated by Digital Mars D Compiler v2093 #pragma once #include <stddef.h> #include <stdint.h> struct Bar; struct Bar { int32_t a; Bar() : a() {} }; extern void fooBar(int32_t a = 42, Bar b); ``` Which won't compile because: ``` ffff.h:17:40: error: missing default argument on parameter 'b' extern void fooBar(int32_t a = 42, Bar b); ^ 1 error generated. ``` Marking as blocker as dtoh is required by the DMD CI.
Comment #1 by pro.mathias.lang — 2020-10-14T18:00:56Z