[Issue 21304] New: dtoh silently ignore default parameters, leading to invalid headers
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Sun Oct 11 10:37:35 UTC 2020
    
    
  
https://issues.dlang.org/show_bug.cgi?id=21304
          Issue ID: 21304
           Summary: dtoh silently ignore default parameters, leading to
                    invalid headers
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: C++
          Severity: blocker
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: pro.mathias.lang at gmail.com
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.
--
    
    
More information about the Digitalmars-d-bugs
mailing list