www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 1075] New: dmd reject valid code

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

           Summary: dmd reject valid code
           Product: D
           Version: 1.009
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: davidl 126.com


class test
{
        static char[] c(){return "whateever;";}
        int a;
        class b
        {
                mixin(c());
        }
}
void main()
{

}
after reviewing the document i think my example above should be compilable


-- 
Mar 21 2007
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1075


bugzilla digitalmars.com changed:

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





Static strings can be modified at runtime, which is why this isn't compilable
(it must be known at compile time). Try doing static const char[] instead, that
should work.


-- 
Mar 21 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1075


fvbommel wxs.nl changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |






         static char[] c(){return "whateever;";}
 Static strings can be modified at runtime, which is why this isn't compilable
 (it must be known at compile time). Try doing static const char[] instead, that
 should work.
That's not a static string, that's a static method he's trying to use for CTFE... (Reopening not because I'm sure this should be allowed, but because it was IMHO closed for the wrong reason) --
Mar 21 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1075






class test
{
        static const char[] c(){return "whateever;";}
        int a;
        class b
        {
                mixin(c());
        }
}
void main()
{

}

even above ain't compilabe


-- 
Mar 21 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1075


smjg iname.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |smjg iname.com





I don't quite see why it should.  It would be equivalent to

class test
{
    int a;
    class b
    {
        whateever;
    }
}

but "whateever;" isn't a valid declaration.

If that's just a placeholder, using placeholders like this in code samples
isn't a good idea.  The problem could still be down to what you're trying to
use in that place.  Always use something that a user can test straight out of
the box.


-- 
Mar 23 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1075






class test
{
        static char[] c(){return "this(){};";}
        int a;
        class b
        {
                mixin(c());
        }
}
void main()
{

}

heh, this is an example should be compilable ;)


-- 
Mar 27 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1075


thomas-dloop kuehne.cn changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         OS/Version|Windows                     |All





Added to DStress as
http://dstress.kuehne.cn/run/m/mixin_30_A.d
http://dstress.kuehne.cn/run/m/mixin_30_B.d
http://dstress.kuehne.cn/run/m/mixin_30_C.d
http://dstress.kuehne.cn/run/m/mixin_30_D.d
http://dstress.kuehne.cn/run/m/mixin_30_E.d


-- 
Apr 04 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1075


davidl 126.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |samukha voliacable.com





*** Bug 1447 has been marked as a duplicate of this bug. ***


-- 
Sep 08 2007
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1075


davidl 126.com changed:

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





fixed in dmd 1.021


-- 
Sep 08 2007