Skip to content

Commit

Permalink
Merge pull request #4056 from WalterBright/error-fp
Browse files Browse the repository at this point in the history
C-style function pointers now an error
  • Loading branch information
dnadlinger committed Oct 9, 2014
2 parents d2ab695 + ad9ec83 commit 8b386e8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/parse.c
Expand Up @@ -136,7 +136,7 @@ Dsymbols *Parser::parseModule()
Expressions *exps = NULL;
stc = parseAttribute(&exps);

if (stc == STCproperty || stc == STCnogc || stc == STCdisable ||
if (stc == STCproperty || stc == STCnogc || stc == STCdisable ||
stc == STCsafe || stc == STCtrusted || stc == STCsystem)
{
error("@%s attribute for module declaration is not supported", token.toChars());
Expand Down Expand Up @@ -4423,7 +4423,7 @@ void Parser::checkCstyleTypeSyntax(Loc loc, Type *t, int alt, Identifier *ident)
const char *sp = !ident ? "" : " ";
const char *s = !ident ? "" : ident->toChars();
if (alt & 1) // contains C-style function pointer syntax
::deprecation(loc, "C-style syntax is deprecated. Please use '%s%s%s' instead", t->toChars(), sp, s);
error(loc, "instead of C-style syntax, use D-style '%s%s%s'", t->toChars(), sp, s);
else
::warning(loc, "instead of C-style syntax, use D-style syntax '%s%s%s'", t->toChars(), sp, s);

Expand Down
8 changes: 4 additions & 4 deletions test/fail_compilation/diag_cstyle.d
Expand Up @@ -2,10 +2,10 @@
/*
TEST_OUTPUT:
---
fail_compilation/diag_cstyle.d(14): Deprecation: C-style syntax is deprecated. Please use 'int function(int) fp1' instead
fail_compilation/diag_cstyle.d(15): Deprecation: C-style syntax is deprecated. Please use 'int function(int)* fp3' instead
fail_compilation/diag_cstyle.d(17): Deprecation: C-style syntax is deprecated. Please use 'int function(int) FP' instead
fail_compilation/diag_cstyle.d(19): Deprecation: C-style syntax is deprecated. Please use 'int function() fp' instead
fail_compilation/diag_cstyle.d(14): Error: instead of C-style syntax, use D-style 'int function(int) fp1'
fail_compilation/diag_cstyle.d(15): Error: instead of C-style syntax, use D-style 'int function(int)* fp3'
fail_compilation/diag_cstyle.d(17): Error: instead of C-style syntax, use D-style 'int function(int) FP'
fail_compilation/diag_cstyle.d(19): Error: instead of C-style syntax, use D-style 'int function() fp'
fail_compilation/diag_cstyle.d(19): Warning: instead of C-style syntax, use D-style syntax 'int[] arr'
fail_compilation/diag_cstyle.d(21): Warning: instead of C-style syntax, use D-style syntax 'string[] result'
---
Expand Down

0 comments on commit 8b386e8

Please sign in to comment.