www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 6089] New: __gshared with not static 2D array

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

           Summary: __gshared with not static 2D array
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc



With DMD 2.053 this program:


void main() {
    __gshared int[1][1] foo;
}


Gives:
test.d(2): Error: cannot implicitly convert expression (0) of type int to
int[1u][1u]

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 02 2011
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6089


Iain Buclaw <ibuclaw ubuntu.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ibuclaw ubuntu.com



Similarly, this should be valid code.

void main()
{
   __thread int[1][1] foo;
}


and this shouldn't try to assign a default initialiser at all!

void main()
{
   extern int[1][1] foo;
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 27 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6089


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich gmail.com



08:00:02 PDT ---

 With DMD 2.053 this program:
 
 
 void main() {
     __gshared int[1][1] foo;
 }
This is fixed by Issue 8041.
 Similarly, this should be valid code.
 
 void main()
 {
    __thread int[1][1] foo;
 }
__thread has since been removed.
 and this shouldn't try to assign a default initializer at all!
 
 void main()
 {
    extern int[1][1] foo;
 }
What exactly are the semantics of this? It has D mangling, so where can you define (not declare) foo? I guess you could use mangling hacks such as: extern(C) int[1][1] D4test4mainFZv3fooG1G1i = [[4]]; void main() { extern int[1][1] foo; assert(foo == [[4]]); } Is this ok though? Note that declaring `extern(C) int[1][1] foo;` does already work. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 18 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6089


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull
           Platform|x86                         |All
         AssignedTo|nobody puremagic.com        |andrej.mitrovich gmail.com
         OS/Version|Windows                     |All



08:10:41 PDT ---
https://github.com/D-Programming-Language/dmd/pull/1762

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 18 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6089






 With DMD 2.053 this program:
 
 
 void main() {
     __gshared int[1][1] foo;
 }
This is fixed by Issue 8041.
 Similarly, this should be valid code.
 
 void main()
 {
    __thread int[1][1] foo;
 }
__thread has since been removed.
 and this shouldn't try to assign a default initializer at all!
 
 void main()
 {
    extern int[1][1] foo;
 }
What exactly are the semantics of this? It has D mangling, so where can you define (not declare) foo? I guess you could use mangling hacks such as: extern(C) int[1][1] D4test4mainFZv3fooG1G1i = [[4]]; void main() { extern int[1][1] foo; assert(foo == [[4]]); } Is this ok though? Note that declaring `extern(C) int[1][1] foo;` does already work.
I don't think it should be valid at all to declare an 'extern' variable/function inside another function. Reasons because of the hairiness as you've described. Just my opinion though. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 18 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6089




Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/0503a9eea91e05d74d0a2a4701a7cd50b806c98b
Fixes Issue 6089 - extern variable should not have an initializer.

https://github.com/D-Programming-Language/dmd/commit/f6adf56c67498de17c5a374a04ab50118cda7cc3


Issue 6089 - extern variable should not have an initializer.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 19 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6089


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
         Resolution|                            |FIXED


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 19 2013