Fix #20859 - ICE: class with __vtbl field name causes segfault in Scope::inCfile

This commit is contained in:
Dennis Korpel 2025-02-16 00:27:18 +01:00 committed by The Dlang Bot
parent 72a9347165
commit eb083c06d9
2 changed files with 13 additions and 1 deletions

View file

@ -4137,7 +4137,8 @@ private extern(C++) class AddMemberVisitor : Visitor
}
// If using C tag/prototype/forward declaration rules
if (sc.flags & SCOPE.Cfile && !dsym.isImport())
if (sc && sc.flags & SCOPE.Cfile && !dsym.isImport())
// When merging master, replace with: if (sc && sc.inCfile && !dsym.isImport())
{
if (handleTagSymbols(*sc, dsym, s2, sds))
return;

View file

@ -0,0 +1,11 @@
/**
TEST_OUTPUT:
---
fail_compilation/test20859.d(8): Error: variable `test20859.ICE.__vtbl` conflicts with variable `test20859.ICE.__vtbl` at fail_compilation/test20859.d(10)
---
*/
class ICE
{
void **__vtbl;
}