digitalmars.D.bugs - [Issue 2221] New: Bug with typeof(*this) in template struct
- d-bugmail puremagic.com (58/58) Jul 12 2008 http://d.puremagic.com/issues/show_bug.cgi?id=2221
- d-bugmail puremagic.com (8/8) Jul 12 2008 http://d.puremagic.com/issues/show_bug.cgi?id=2221
- d-bugmail puremagic.com (13/13) Nov 04 2008 http://d.puremagic.com/issues/show_bug.cgi?id=2221
- d-bugmail puremagic.com (13/13) Sep 04 2009 http://d.puremagic.com/issues/show_bug.cgi?id=2221
http://d.puremagic.com/issues/show_bug.cgi?id=2221 Summary: Bug with typeof(*this) in template struct Product: D Version: 1.032 Platform: PC OS/Version: Windows Status: NEW Keywords: rejects-valid Severity: normal Priority: P2 Component: DMD AssignedTo: bugzilla digitalmars.com ReportedBy: wbaxter gmail.com Here's the code: ----- struct Struct(T) { static if (is(typeof(T.nan))) { static const is_fptype = true; } else { static const is_fptype = false; } static if(typeof(*this).is_fptype) //static if((typeof(*this)).is_fptype) //<- fixes it { pragma(msg, "T is " ~ T.stringof); pragma(msg, typeof(*this).stringof ~ " is fp type"); } else { pragma(msg, "T is " ~ T.stringof); pragma(msg, typeof(*this).stringof ~ " is NOT fp type"); } } alias Struct!(float) Sf; alias Struct!(int) Si; ------- From compiling that I get the output: """ T is float Struct!(float) is fp type T is int Struct!(float) is fp type """ The output expected is: """ T is float Struct!(float) is fp type T is int Struct!(int) is NOT fp type """ And that is the output you get if you stick extra parentheses around (typeof(*this)). This was tested on D1.033. Possibly related to: * http://d.puremagic.com/issues/show_bug.cgi?id=2219 * http://d.puremagic.com/issues/show_bug.cgi?id=2154 --
Jul 12 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2221 braddr puremagic.com changed: What |Removed |Added ---------------------------------------------------------------------------- Version|1.032 |1.033 Added 1.033 to the list of versions and updated the bug to reference it. --
Jul 12 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2221 korslund gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- OS/Version|Windows |All Also possibly related to: http://d.puremagic.com/issues/show_bug.cgi?id=2359 The various typeof(this) bugs seems appear in 1.032 and onward, and not be present in 1.031 and earlier. The changelog for 1.032 lists several items relating to typeof, so it's reasonable to assume that one of the fixes introduced this bug. --
Nov 04 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2221 Don <clugdbug yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |clugdbug yahoo.com.au Resolution| |FIXED This was fixed in 1.039/2.023, but not listed in the changelog. (it's the same root cause as bug 2527). -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 04 2009