Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
March 09, 2013 [Issue 9671] New: Getting class object typeid in CTFE is not supported | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=9671 Summary: Getting class object typeid in CTFE is not supported Product: D Version: D2 Platform: All OS/Version: All Status: NEW Keywords: CTFE Severity: major Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: k.hara.pg@gmail.com Blocks: 3789 --- Comment #0 from Kenji Hara <k.hara.pg@gmail.com> 2013-03-09 02:39:16 PST --- This code should work. class Class {} bool test1() { Object c = new Class; return typeid(c) is typeid(c); } static assert(test1() == true); bool test2() { Object c = new Class; Object o = new Object; return typeid(c) is typeid(o); } static assert(test2() == false); This is necessary for class object comparison in CTFE. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
March 09, 2013 [Issue 9671] [CTFE] Class object cannot compare in compile time | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kenji Hara | http://d.puremagic.com/issues/show_bug.cgi?id=9671 Kenji Hara <k.hara.pg@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|Getting class object typeid |[CTFE] Class object cannot |in CTFE is not supported |compare in compile time --- Comment #1 from Kenji Hara <k.hara.pg@gmail.com> 2013-03-09 06:29:20 PST --- Add more general test case, and change the summary. ---- bool test() { class Class {} Object c = new Class; Object o = new Object; return c != o; // line 7 } void main() { assert(test()); } // pass static assert(test()); // line 10 output: ---- test.d(7): Error: opEquals cannot be interpreted at compile time, because it has no available source code test.d(10): called from here: test() test.d(10): while evaluating: static assert(test()) -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
March 11, 2013 [Issue 9671] [CTFE] Class object cannot compare in compile time | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kenji Hara | http://d.puremagic.com/issues/show_bug.cgi?id=9671 Don <clugdbug@yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |DUPLICATE --- Comment #2 from Don <clugdbug@yahoo.com.au> 2013-03-11 04:10:21 PDT --- *** This issue has been marked as a duplicate of issue 7151 *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation