[Issue 4419] __gshared static in class has no effect

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Feb 23 06:16:20 PST 2011


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


Trass3r <mrmocool at gmx.de> changed:

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


--- Comment #2 from Trass3r <mrmocool at gmx.de> 2011-02-23 06:13:36 PST ---
Ok, part of the magic happens in StorageClassDeclaration::semantic() in
attrib.c (which btw duplicates setScope!):

StorageClass scstc = sc->stc;

/* These sets of storage classes are mutually exclusive,
 * so choose the innermost or most recent one.
 */
if (stc & (STCauto | STCscope | STCstatic | STCextern | STCmanifest))
    scstc &= ~(STCauto | STCscope | STCstatic | STCextern | STCmanifest);
if (stc & (STCauto | STCscope | STCstatic | STCtls | STCmanifest | STCgshared))
    scstc &= ~(STCauto | STCscope | STCstatic | STCtls | STCmanifest |
STCgshared);
...
scstc |= stc;

In b's case sc->stc is 0, thus nothing gets truncated and scstc = stc, which is
ok cause stc correctly was set to STCstatic | STCgshared before.

In a's case however sc->stc == STCgshared, so it gets cut out by the second if
statement. Then scstc is set to stc which is equal to STCstatic.


So there are in fact 4 issues here:
1) Why is static and __gshared mutually exclusive, doesn't __gshared imply
static?
2) Why isn't shared handled in that list?
3) Why the difference regarding to the scopes? According to my debug view they
are perfectly identical except for the storage class.
4) Why the difference in stc?

-- 
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