542 – Function parameter of a deprecated type (other than a class) is not caught

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 542 - Function parameter of a deprecated type (other than a class) is not caught
Summary: Function parameter of a deprecated type (other than a class) is not caught
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D1 (retired)
Hardware: x86 Windows
: P2 normal
Assignee: Walter Bright
URL:
Keywords: accepts-invalid
Depends on:
Blocks:
Reported: 2006年11月17日 14:03 UTC by Stewart Gordon
Modified: 2014年02月15日 13:21 UTC (History)
0 users

See Also:


Attachments
Add an attachment (proposed patch, testcase, etc.)

Note You need to log in before you can comment on or make changes to this issue.
Description Stewart Gordon 2006年11月17日 14:03:30 UTC
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.
Comment 1 Walter Bright 2008年07月09日 22:33:45 UTC
Fixed dmd 1.032 and 2.016


AltStyle によって変換されたページ (->オリジナル) /