http://d.puremagic.com/issues/show_bug.cgi?id=3450


Don <clugd...@yahoo.com.au> changed:

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


--- Comment #1 from Don <clugd...@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: -------

Reply via email to