[Issue 3450] incorrect result for is (typeof({ ... }())) inside a struct

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Jan 16 23:30:17 PST 2010


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


Don <clugdbug at yahoo.com.au> changed:

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


--- Comment #1 from Don <clugdbug at 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: -------


More information about the Digitalmars-d-bugs mailing list