[Issue 9078] New: non-static opCall is chosen instead of a default constructor
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Nov 25 10:26:50 PST 2012
http://d.puremagic.com/issues/show_bug.cgi?id=9078
Summary: non-static opCall is chosen instead of a default
constructor
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: void.unsigned at gmail.com
--- Comment #0 from void.unsigned at gmail.com 2012-11-25 10:26:49 PST ---
[From the thread at:
http://forum.dlang.org/thread/sntkmtabuhuctcbnlsgq@forum.dlang.org]
The following code:
struct A
{
int i;
void opCall(int i) {
}
}
void main() {
auto a = A(42);
}
fails to compile with errors:
Error: variable deneme.main.a type void is inferred from initializer
opCall(42), and variables cannot be of type void
Error: expression opCall(42) is void and has no value
A non-static opCall is chosen instead of a default constructor.
The non-static opCall() overloads should not interfere with construction.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list