Skip to content

Commit

Permalink
ImportC: better diagnostic for malformed __declspec
Browse files Browse the repository at this point in the history
  • Loading branch information
WalterBright authored and dlang-bot committed Aug 22, 2023
1 parent 5fd40ad commit cc0777a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
6 changes: 4 additions & 2 deletions compiler/src/dmd/cparse.d
Original file line number Diff line number Diff line change
Expand Up @@ -3298,8 +3298,10 @@ final class CParser(AST) : Parser!AST
nextToken();
else
{
error("extended-decl-modifier expected");
break;
error("extended-decl-modifier expected after `__declspec(`, saw `%s` instead", token.toChars());
nextToken();
if (token.value != TOK.rightParenthesis)
break;
}
}
}
Expand Down
7 changes: 7 additions & 0 deletions compiler/test/fail_compilation/msg24094.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/* TEST_OUTPUT:
---
fail_compilation/msg24094.c(7): Error: extended-decl-modifier expected after `__declspec(`, saw `*` instead
---
*/

__declspec(*) void* __cdecl _calloc_base(int, int);

0 comments on commit cc0777a

Please sign in to comment.