digitalmars.D.bugs - [Issue 5877] New: Cannot 'alias __traits(parent, obj) X;'
- d-bugmail puremagic.com (41/41) Apr 23 2011 http://d.puremagic.com/issues/show_bug.cgi?id=5877
- d-bugmail puremagic.com (17/17) Apr 24 2011 http://d.puremagic.com/issues/show_bug.cgi?id=5877
- d-bugmail puremagic.com (12/12) Dec 10 2012 http://d.puremagic.com/issues/show_bug.cgi?id=5877
http://d.puremagic.com/issues/show_bug.cgi?id=5877 Summary: Cannot 'alias __traits(parent, obj) X;' Product: D Version: D2 Platform: All OS/Version: All Status: NEW Keywords: rejects-valid Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: kennytm gmail.com --- Comment #0 from kennytm gmail.com 2011-04-23 23:13:49 PDT --- Since the introduction of __traits(parent) in commit 2e261cd6, it is possible that the __traits expression returns a type. However, the parser does not recognize this in an alias statement, and rejects the code. -------------------------------------------------------- class B { int x(); alias __traits(parent, x) S; static assert(is(B == S)); } -------------------------------------------------------- x.d(3): basic type expected, not __traits x.d(3): no identifier for declarator int x.d(3): semicolon expected to close alias declaration x.d(3): Declaration expected, not '__traits' -------------------------------------------------------- A workaround is to create an existing expression that returns a type: -------------------------------------------------------- class B { int x(); alias typeof(__traits(parent, x).init) S; static assert(is(B == S)); } -------------------------------------------------------- But it is better the __traits work without these hacks. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Apr 23 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5877 kennytm gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|Cannot 'alias |Cannot treat |__traits(parent, obj) X;' |'__traits(parent, obj)' as | |a type --- Comment #1 from kennytm gmail.com 2011-04-24 01:08:14 PDT --- The same applies anywhere that expects a type, e.g. template (alias m, T = __traits(parent, m)) { // ^^^^^^^^^^^^^^^^^^^ __traits(parent, m) s; // ^^^^^^^^^^^^^^^^^^^ etc. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Apr 24 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5877 Andrej Mitrovic <andrej.mitrovich gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |andrej.mitrovich gmail.com Resolution| |DUPLICATE --- Comment #2 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2012-12-10 15:42:43 PST --- *** This issue has been marked as a duplicate of issue 7804 *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 10 2012