File: lambdas_dmd23722.d

package info (click to toggle)
ldc 1%3A1.40.0-5
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 63,308 kB
  • sloc: cpp: 85,368; ansic: 21,877; makefile: 1,705; sh: 1,018; asm: 584; objc: 135; exp: 48; python: 12
file content (21 lines) | stat: -rw-r--r-- 557 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Test that colliding lambda mangles don't lead to symbol collision during linking,
// see https://issues.dlang.org/show_bug.cgi?id=23722

// compile both modules separately, then link and check runtime output
// RUN: %ldc -c %S/inputs/lambdas_dmd23722b.d -of=%t_b%obj
// RUN: %ldc -I%S/inputs %s %t_b%obj -of=%t%exe
// RUN: %t%exe | FileCheck %s

import lambdas_dmd23722b;

// do_y should call A.y (and print "y")
void do_y() {
    A.y();
}

void main() {
    // CHECK: y
    do_y(); // should print y
    // CHECK-NEXT: x
    do_x(); // should print x
}