mirror of
https://github.com/dlang/dmd.git
synced 2025-04-26 21:21:48 +03:00
This commit is contained in:
parent
ffbad272b6
commit
f37cfdf837
2 changed files with 19 additions and 3 deletions
|
@ -248,13 +248,14 @@ nothrow:
|
||||||
* directly, but that would unnecessary lengthen symbols names. See issue:
|
* directly, but that would unnecessary lengthen symbols names. See issue:
|
||||||
* https://issues.dlang.org/show_bug.cgi?id=23722
|
* https://issues.dlang.org/show_bug.cgi?id=23722
|
||||||
*/
|
*/
|
||||||
static struct Key { uint fileOffset; string prefix; string parent; }
|
static struct Key { string locKey; string prefix; string parent; }
|
||||||
__gshared uint[Key] counters;
|
__gshared uint[Key] counters;
|
||||||
|
|
||||||
|
string locKey = cast(string) (sl.filename ~ idBuf[]);
|
||||||
static if (__traits(compiles, counters.update(Key.init, () => 0u, (ref uint a) => 0u)))
|
static if (__traits(compiles, counters.update(Key.init, () => 0u, (ref uint a) => 0u)))
|
||||||
{
|
{
|
||||||
// 2.082+
|
// 2.082+
|
||||||
counters.update(Key(loc.fileOffset, prefix, parent),
|
counters.update(Key(locKey, prefix, parent),
|
||||||
() => 1u, // insertion
|
() => 1u, // insertion
|
||||||
(ref uint counter) // update
|
(ref uint counter) // update
|
||||||
{
|
{
|
||||||
|
@ -266,7 +267,7 @@ nothrow:
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const key = Key(loc.fileOffset, prefix, parent);
|
const key = Key(locKey, prefix, parent);
|
||||||
if (auto pCounter = key in counters)
|
if (auto pCounter = key in counters)
|
||||||
{
|
{
|
||||||
idBuf.writestring("_");
|
idBuf.writestring("_");
|
||||||
|
|
15
compiler/test/runnable/test20831.c
Normal file
15
compiler/test/runnable/test20831.c
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
// https://github.com/dlang/dmd/issues/20831
|
||||||
|
#include "assert.h"
|
||||||
|
|
||||||
|
int* p;
|
||||||
|
|
||||||
|
#define IMPL() \
|
||||||
|
f()\
|
||||||
|
{\
|
||||||
|
assert(p);\
|
||||||
|
assert(0);\
|
||||||
|
}
|
||||||
|
|
||||||
|
void IMPL()
|
||||||
|
|
||||||
|
void main(void) {}
|
Loading…
Add table
Add a link
Reference in a new issue