D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 20336 - Regression (2.088.1) C++ mangling problem with multiple const ref parameters
Summary: Regression (2.088.1) C++ mangling problem with multiple const ref parameters
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86 Mac OS X
: P1 regression
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-10-30 03:25 UTC by Andrej Mitrovic
Modified: 2019-11-01 06:51 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Andrej Mitrovic 2019-10-30 03:25:52 UTC
cpp.cpp:
-----
struct Value { };

void one (Value const& a)
{
}

void two (Value const& a, Value const& b)
{
}
-----

test.d:
-----
struct Value { }

extern(C++) void one(ref const(Value) a);
extern(C++) void two(ref const(Value) a, ref const(Value) b);

void main ()
{
    Value value;
    one(value);
    two(value, value);  // linker error with 2.088.1
}
-----

2.088.1:

-----
$ g++ -c -g -fPIC -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++14 cpp.cpp
$ rdmd --force -L-lstdc++ -vcolumns cpp.o test.d

Undefined symbols for architecture x86_64:
  "two(Value const&, Value const)", referenced from:
      __Dmain in test.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Error: linker exited with status 1
-----

Works ok with 2.088.0
Comment 1 Andrej Mitrovic 2019-10-30 03:27:27 UTC
It looks like the `ref` is gone in the mangling of `two`.
Comment 2 Mathias LANG 2019-11-01 06:51:55 UTC
Fixed by https://github.com/dlang/dmd/pull/10477 (commit named: "dmd/cppmangle.d: Fix regression in ref substitution").