[Issue 2171] errors involving anonymous class literals expose compiler internals
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Sep 27 01:26:50 PDT 2012
http://d.puremagic.com/issues/show_bug.cgi?id=2171
Don <clugdbug at yahoo.com.au> changed:
What |Removed |Added
----------------------------------------------------------------------------
Version|D1 |D1 & D2
Summary|bizzare toCBuffer result |errors involving anonymous
|when emit error message for |class literals expose
|bad source code |compiler internals
--- Comment #1 from Don <clugdbug at yahoo.com.au> 2012-09-27 01:27:29 PDT ---
Original title:
bizzare toCBuffer result when emit error message for bad source code
Applies to both D1 and D2.
Reduced test case:
void f() {
int k = new class(){};
}
-----
bug.d(3): Error: cannot implicitly convert expression (class __anonclass1 :
Object
{
void* this;
}
, new __anonclass1) of type bug.f.__anonclass1 to int
-----
Another example, not involving an error:
void f() {
pragma(msg, (new class(){ void get(char[] s){} }).stringof);
}
which prints invalid D code:
----------------------------------
class __anonclass1 : Object
{
void get(char[] s)
{
assert(this,"null this");
}
void* this;
}
, new __anonclass1
----------------------------------
When printing the expression I don't think it should be printing the class
contents. Would be enough to display:
bug.d(3): Error: cannot implicitly convert expression `new __anonclass1` of
type bug.f.__anonclass1 to int
--
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