Skip to content

Commit

Permalink
Merge pull request #6415 from ibuclaw/issue17074
Browse files Browse the repository at this point in the history
Fix Issue 17074: extern(C++, keyword) crashes compiler
  • Loading branch information
MartinNowak authored Jan 11, 2017
2 parents 45c886f + e451607 commit b35ec9c
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/parse.d
Original file line number Diff line number Diff line change
Expand Up @@ -2185,7 +2185,10 @@ final class Parser : Lexer
}
}
else
{
error("identifier expected for C++ namespace");
idents = null; // error occurred, invalidate list of elements.
}
break;
}
}
Expand Down
39 changes: 39 additions & 0 deletions test/fail_compilation/ice17074.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
TEST_OUTPUT:
---
fail_compilation/ice17074.d(9): Error: identifier expected for C++ namespace
fail_compilation/ice17074.d(9): Error: found 'cast' when expecting ')'
fail_compilation/ice17074.d(9): Error: declaration expected, not ')'
---
*/
extern(C++, cast) void ice_keyword();

/*
TEST_OUTPUT:
---
fail_compilation/ice17074.d(19): Error: identifier expected for C++ namespace
fail_compilation/ice17074.d(19): Error: found '__overloadset' when expecting ')'
fail_compilation/ice17074.d(19): Error: declaration expected, not ')'
---
*/
extern(C++, std.__overloadset) void ice_std_keyword();

/*
TEST_OUTPUT:
---
fail_compilation/ice17074.d(29): Error: identifier expected for C++ namespace
fail_compilation/ice17074.d(29): Error: found '...' when expecting ')'
fail_compilation/ice17074.d(29): Error: declaration expected, not ')'
---
*/
extern(C++, ...) void ice_token();

/*
TEST_OUTPUT:
---
fail_compilation/ice17074.d(39): Error: identifier expected for C++ namespace
fail_compilation/ice17074.d(39): Error: found '*' when expecting ')'
fail_compilation/ice17074.d(39): Error: declaration expected, not ')'
---
*/
extern(C++, std.*) void ice_std_token();

0 comments on commit b35ec9c

Please sign in to comment.