[Issue 542] New: Function parameter of a deprecated type (other than a class) is not caught
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Nov 17 12:03:31 PST 2006
http://d.puremagic.com/issues/show_bug.cgi?id=542
Summary: Function parameter of a deprecated type (other than a
class) is not caught
Product: D
Version: 0.174
Platform: PC
OS/Version: Windows
Status: NEW
Keywords: accepts-invalid
Severity: normal
Priority: P2
Component: DMD
AssignedTo: bugzilla at digitalmars.com
ReportedBy: smjg at iname.com
The types defined in this code are all deprecated. However, the compiler fails
to report a single error for their use as function parameters.
----------
deprecated {
struct DepStruct {}
union DepUnion {}
enum DepEnum { A }
alias int DepAlias;
typedef int DepTypedef;
}
void func(DepStruct obj) {}
void func(DepUnion obj) {}
void func(DepEnum obj) {}
void func(DepAlias obj) {}
void func(DepTypedef obj) {}
----------
This is not likely to cause much of a problem when it occurs in application
code, since without -d they shouldn't be able to create anything of the
deprecated types anyway.
However, it can give a nasty shock to users of a library when the library
programmer has failed to notice it. If a library depends on a deprecated type
(in Phobos or another library) as a function parameter, the library programmer
may need to update the library to work on the type that has superseded the
deprecated type. As long as the compiler is failing to diagnose an error,
somebody updating a library to the latest version of DMD, Phobos or another
library is quite likely to miss these and then release a library that isn't as
up-to-date as it's cracked up to be.
--
More information about the Digitalmars-d-bugs
mailing list