diff --git a/changelog/dmd.enum-function.dd b/changelog/dmd.enum-function.dd new file mode 100644 index 000000000000..5caf34d24e4b --- /dev/null +++ b/changelog/dmd.enum-function.dd @@ -0,0 +1,3 @@ +A function with enum storage class is now deprecated, not an error + +The error was introduced in 2.105.0. diff --git a/compiler/src/dmd/parse.d b/compiler/src/dmd/parse.d index d15e448150fa..a42cc14664b9 100644 --- a/compiler/src/dmd/parse.d +++ b/compiler/src/dmd/parse.d @@ -4581,8 +4581,10 @@ class Parser(AST, Lexer = dmd.lexer.Lexer) : Lexer } else if (t.ty == Tfunction) { + /* @@@DEPRECATED_2.115@@@ + * change to error, deprecated in 2.105.1 */ if (storage_class & STC.manifest) - error("function cannot have enum storage class"); + deprecation("function cannot have enum storage class"); AST.Expression constraint = null; //printf("%s funcdecl t = %s, storage_class = x%lx\n", loc.toChars(), t.toChars(), storage_class); diff --git a/compiler/test/fail_compilation/enum_function.d b/compiler/test/fail_compilation/enum_function.d index b22f2ceccef7..52b71d12f5d9 100644 --- a/compiler/test/fail_compilation/enum_function.d +++ b/compiler/test/fail_compilation/enum_function.d @@ -1,10 +1,11 @@ /* +REQUIRED_ARGS: -de TEST_OUTPUT: --- -fail_compilation/enum_function.d(10): Error: function cannot have enum storage class -fail_compilation/enum_function.d(11): Error: function cannot have enum storage class -fail_compilation/enum_function.d(12): Error: function cannot have enum storage class -fail_compilation/enum_function.d(13): Error: function cannot have enum storage class +fail_compilation/enum_function.d(11): Deprecation: function cannot have enum storage class +fail_compilation/enum_function.d(12): Deprecation: function cannot have enum storage class +fail_compilation/enum_function.d(13): Deprecation: function cannot have enum storage class +fail_compilation/enum_function.d(14): Deprecation: function cannot have enum storage class --- */ enum void f1() { return; }