www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3450] New: is (typeof({ ... }())) unexpected return

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3450

           Summary: is (typeof({ ... }())) unexpected return
           Product: D
           Version: 2.035
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: critical
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: kamaboco gmail.com


--- Comment #0 from kamaboco gmail.com 2009-10-29 08:19:37 PDT ---
struct Foo
{
    enum bool BAR = is (typeof({}()));
    // Error: static assert  (0 == 1) is false
    static assert (BAR == is (typeof({}())));
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 29 2009
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3450


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|rejects-valid               |patch, wrong-code
                 CC|                            |clugdbug yahoo.com.au
            Summary|is (typeof({ ... }()))      |incorrect result for is
                   |unexpected return           |(typeof({ ... }())) inside
                   |                            |a struct


--- Comment #1 from Don <clugdbug yahoo.com.au> 2010-01-16 23:30:16 PST ---
PATCH: in FuncDeclaration::semantic3(), it's forbidden to use function literals
as class members. But, it should be OK to use them inside a typeof()
expression.
----------

Index: func.c
===================================================================
--- func.c    (revision 335)
+++ func.c    (working copy)
   -789,14 +789,14   
     if (ad)
     {   VarDeclaration *v;

-        if (isFuncLiteralDeclaration() && isNested())
+        if (isFuncLiteralDeclaration() && isNested() && !sc->intypeof)
         {
         error("literals cannot be class members");
         return;
         }
         else
         {
-        assert(!isNested());    // can't be both member and nested
+        assert(!isNested() || sc->intypeof);    // can't be both member and
nested
         assert(ad->handle);
         Type *thandle = ad->handle;
 #if STRUCTTHISREF

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 16 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3450


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla digitalmars.com


--- Comment #2 from Walter Bright <bugzilla digitalmars.com> 2010-02-05
19:54:33 PST ---
changeset 371

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 05 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3450


Kosmonaut <Kosmonaut tempinbox.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |Kosmonaut tempinbox.com


--- Comment #3 from Kosmonaut <Kosmonaut tempinbox.com> 2010-02-05 23:39:34 PST
---
(In reply to comment #2)
 changeset 371

http://www.dsource.org/projects/dmd/changeset/371 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 05 2010
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3450


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


--- Comment #4 from Walter Bright <bugzilla digitalmars.com> 2010-03-08
22:20:53 PST ---
Fixed dmd 1.057 and 2.041

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 08 2010