www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Bug 20] New: volatile introduces new scope

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

           Summary: volatile introduces new scope
           Product: D
           Version: 0.148
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: walter digitalmars.com
        ReportedBy: thomas-dloop kuehne.cn


void main(){
    int i = 1;
    volatile int i = 2; // should fail to compile
}

Testcases:
http://dstress.kuehne.cn/run/v/volatile_03_A.d
http://dstress.kuehne.cn/run/v/volatile_03_B.d
http://dstress.kuehne.cn/nocompile/v/volatile_03_C.d


-- 
Mar 06 2006
next sibling parent reply d-bugmail puremagic.com writes:
http://d.puremagic.com/bugzilla/show_bug.cgi?id=20


smjg iname.com changed:

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




------- Comment #1 from smjg iname.com  2006-03-06 11:26 -------
All runtime control statements of this kind introduce a scope.  What bit of the
spec states that volatile is any different?

As I understand it:
- volatile_03_A is correctly classified
- volatile_03_B is incorrectly classified, because i is out of scope outside of
the volatile statement
- volatile_03_C is correctly classified, but for a different reason, namely "A
local symbol's name, however, must be unique within the function."


-- 
Mar 06 2006
parent Thomas Kuehne <thomas-dloop kuehne.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

d-bugmail puremagic.com schrieb am 2006-03-06:
 All runtime control statements of this kind introduce a scope.  What bit of the
 spec states that volatile is any different?

The current documentation states: # VolatileStatement: volatile Statement That is "Statement" instead of "BlockStatement" - thus not necessarily a new scope. Either I'm missing something - if you know, pleace quote - or the scoping of a few "*Statement"s looks fishy: # IfStatement: if ( IfCondition ) ThenStatement # IfStatement: if ( IfCondition ) ThenStatement else ElseStatement # ElseStatement: Statement # ThenStatement: Statement # if(true) # int i=2; # # assert(i == 2); // according to the docs: legal A quick search for "Statement" and "scope" didn't return any usefull hits. Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFEDJlJ3w+/yD4P9tIRAtTTAKC2IvC45LJYuspT4aXRIGytNUtJegCfevFn 7qwwLMc6VYmeRLKl7GgbCSM= =0PXJ -----END PGP SIGNATURE-----
Mar 06 2006
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/bugzilla/show_bug.cgi?id=20


bugzilla digitalmars.com changed:

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




------- Comment #4 from bugzilla digitalmars.com  2006-03-20 22:20 -------
Fixed 0.150


-- 
Mar 20 2006