mirror of
https://github.com/dlang/dmd.git
synced 2025-04-27 13:40:11 +03:00
Fix 23752 - ImportC: can't take address of dereferenced void pointer (#14970)
This commit is contained in:
parent
23514c6256
commit
2ad82c66d1
2 changed files with 13 additions and 0 deletions
|
@ -7309,6 +7309,14 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
|
|||
goto case Terror;
|
||||
}
|
||||
|
||||
if (sc.flags & SCOPE.Cfile && exp.type && exp.type.toBasetype().ty == Tvoid)
|
||||
{
|
||||
// https://issues.dlang.org/show_bug.cgi?id=23752
|
||||
// `&*((void*)(0))` is allowed in C
|
||||
result = exp;
|
||||
return;
|
||||
}
|
||||
|
||||
if (exp.checkValue())
|
||||
return setError();
|
||||
|
||||
|
|
|
@ -190,3 +190,8 @@ const typeof(testTypeofA) testTypeofB = 0;
|
|||
_Static_assert(sizeof(testTypeofB) == sizeof(short), "17");
|
||||
|
||||
/*************************************************/
|
||||
|
||||
// https://issues.dlang.org/show_bug.cgi?id=23752
|
||||
void *c23752 = &*((void*)(0));
|
||||
|
||||
/*************************************************/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue