764 – (typeof(o)).classinfo causes parser error

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 764 - (typeof(o)).classinfo causes parser error
Summary: (typeof(o)).classinfo causes parser error
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86 All
: P2 normal
Assignee: Walter Bright
URL:
Keywords:
Depends on:
Blocks:
Reported: 2006年12月28日 17:56 UTC by Dan
Modified: 2015年06月09日 05:15 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 Dan 2006年12月28日 17:56:41 UTC
For the following source code:
void main() {
 Object o = new Object();
 printf("%*s\n", typeof(o).classinfo.name); // compiles ok
 printf("%*s\n", (typeof(o)).classinfo.name); // error
}
compilation fails (on win32) with the following message:
main.d(4): found '.' when expecting ','
--- errorlevel 1
Comment 1 Dan 2006年12月28日 19:35:19 UTC
== Quote from d-bugmail (d-bugmail@puremagic.com)'s article
> http://d.puremagic.com/issues/show_bug.cgi?id=764
> Summary: (typeof(o)).classinfo causes parser error
> Product: D
> Version: unspecified
> Platform: PC
> OS/Version: Windows
> Status: NEW
> Severity: normal
> Priority: P2
> Component: DMD
> AssignedTo: bugzilla@digitalmars.com
> ReportedBy: ddaglas@gmail.com
> For the following source code:
> void main() {
> Object o = new Object();
> printf("%*s\n", typeof(o).classinfo.name); // compiles ok
> printf("%*s\n", (typeof(o)).classinfo.name); // error
> }
> compilation fails (on win32) with the following message:
> main.d(4): found '.' when expecting ','
> --- errorlevel 1
On a related note, compiling with -H added the ()'s around the typeof(...) in the
resulting .di file, which subsequently triggered the bug.
Is it a bug that DMD adds the ()'s around the typeof(...)?
--Dan
Comment 2 Walter Bright 2007年01月03日 22:16:01 UTC
Fixed DMD 1.00
Comment 3 Thomas Kühne 2007年02月27日 10:48:01 UTC
Added to DStress as
http://dstress.kuehne.cn/run/t/typeof_16_A.d
http://dstress.kuehne.cn/run/t/typeof_16_B.d 


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