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



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



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



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



---

 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



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