ldc icon indicating copy to clipboard operation
ldc copied to clipboard

Using undefined identifier in lambda function causes ldc crash (Win64)

Open 0-v-0 opened this issue 2 years ago • 1 comments

The following code crashes LDC: test.d:

/+ dub.sdl:
dependency "mustache-d" version="~>0.1.5"
+/
import mustache;
void main() {
	MustacheEngine!string m;
	auto ctx = new Context;
	auto render = (string s) => m.renderString(s, ctx);
}

Note that the following doesn't:

/+ dub.sdl:
dependency "mustache-d" version="~>0.1.5"
+/
import mustache;
void main() {
	MustacheEngine!string m;
	auto ctx = new m.Context;
	auto render = (string s) => m.renderString(s, ctx);
}

Log:

dub test.d
test.d(7,13): Error: undefined identifier `Context`
0x00007FF769FDBBD9 (0x0000000000000000 0x0000025400000000 0x0000000000000000 0x000000DC711FDCF8)
0x00007FF769FDBD32 (0x00000254ED90F7D0 0x00000254E6CC88F0 0x00000254ED90F7D0 0x00000254E6CC89A0)
0x00007FF76A189D12 (0x00000254E51902A8 0x0000000000000000 0x0000000000000020 0x00000254E5190CC0)
0x00007FF76A1A6AF8 (0x00000254E51902A8 0x00007FF76A0E67B1 0x0000000000000020 0x00000254E5190CC0)
0x00007FF76A1A272E (0x0000025400000000 0x00000254E5191EC0 0x00000254ED9100B0 0x00000254E6CC8920)
0x00007FF76A02D85B (0x0000000000000000 0xFFFFFFFFFFFFFFFE 0x0000000000000000 0x0000000000000000)
0x00007FF76A0D4DEC (0x0000000000000002 0x00000254E8F3A410 0x000000DC711FE298 0x0000000000000000)
0x00007FF76A0D4224 (0x0000000004E8009A 0x00000000000000F8 0x00000254EB700300 0x00007FF76A155A9C)
0x00007FF76A15A619 (0x0000000000000010 0x00007FF76A37B1F7 0x000000DC711FE820 0x00007FF769FE0B24)
0x00007FF76A0071E1 (0x000000DC711FE7E0 0x00007FF76A155C6A 0x00000254E6CC7C50 0x00007FF76A11AFAF)
0x00007FF76A16C2C2 (0xFFFFFFFFFFFFFFFE 0x00000254E6CC79E0 0x0000000000000003 0x000000DC711FF1E0)
0x00007FF76A006F2B (0x00007FF76BB418B1 0x00000000000000B0 0x00000254E5200150 0x000000000000015E)
0x00007FF76A1EC78E (0x000000000000000F 0x0000000000000000 0x000000000000000F 0x0000000000000000)
0x00007FF76A254F2A (0x0000006500000000 0x000002542A00002A 0x00007FF76802869D 0x0000000000000022)
0x00007FF76A35F189 (0x0000000300000002 0x0000000000000000 0x00007FF76BAC32D3 0x0000000000000000)
0x00007FF76A35EDC9 (0x0000000000000008 0x000000DC711FFA80 0x000000DC711FFA20 0x0000000000000001)
0x00007FF76A35F111 (0x00007FF70000003C 0x0000000000000000 0x00000254E52C2C13 0x000000000000003C)
0x00007FF76A24FC2F (0x0000000000000000 0x00007FF76A3895CD 0x0000000000000000 0x0000000000000000)
0x00007FF76A389554 (0x0000000000000000 0x00007FFF3DA82630 0x0000000000000000 0x0000000000000000)
0x00007FFF3BBF7034 (0x00000000004E004C 0x00000254E5180100 0x0000000000000000 0x0000000000000000), BaseThreadInitThunk() + 0x14 bytes(s)
0x00007FFF3DA82651 (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), RtlUserThreadStart() + 0x21 bytes(s)
ldc2\bin\ldc2.exe failed with exit code -1073741819.

OS: Windows 10 21H2 19044.1387

ldc2 --version
LDC - the LLVM D compiler (1.28.0):
  based on DMD v2.098.0 and LLVM 12.0.1
  built with LDC - the LLVM D compiler (1.28.0)
  Default target: x86_64-pc-windows-msvc
  Host CPU: sandybridge
  ...

0-v-0 avatar Jan 04 '22 05:01 0-v-0

Can you get it to blow up without the import?

If not, can we have the minimum amount of the mustache file to reproduce the issue

maxhaton avatar Jan 10 '22 11:01 maxhaton