www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3243] New: Mixin 'static this()' bring on a compiler message ': __gate is thread local'

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

           Summary: Mixin 'static this()' bring on a compiler message ':
                    __gate is thread local'
           Product: D
           Version: 2.031
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: minor
          Priority: P3
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: hskwk inter7.jp


template T() {
    static this() {
    }
}

class C {
    mixin T;
}


Compiling this code (with -vtls) brings on a compiler message
: __gate is thread local


I do not know what does this message mean.
Please mark keywords for this issue if you know anything about this message.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 10 2009
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3243


Jeremie Pelletier <jeremiep gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch
                 CC|                            |jeremiep gmail.com


--- Comment #1 from Jeremie Pelletier <jeremiep gmail.com> 2009-09-08 16:00:15
PDT ---
Here's the patch:

--- orig\func.cpp       Thu Sep 03 01:01:40 2009
+++ dmd\func.cpp        Tue Sep 08 18:54:46 2009
   -2759,7 +2759,7   
         */
        Identifier *id = Lexer::idPool("__gate");
        VarDeclaration *v = new VarDeclaration(0, Type::tint32, id, NULL);
-       v->storage_class = STCstatic;
+       v->storage_class = STCstatic | STCgshared;
        Statements *sa = new Statements();
        Statement *s = new DeclarationStatement(0, v);
        sa->push(s);

When a static constructor is coming from a template, a "gate" is added to
prevent running it more than once. That gate was not marked with __gshared.

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