[Issue 199] Label causes scope to collapse into parent

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed May 29 03:01:03 PDT 2013


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


monarchdodra at gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
                 CC|                            |monarchdodra at gmail.com
         Resolution|WONTFIX                     |


--- Comment #10 from monarchdodra at gmail.com 2013-05-29 03:00:58 PDT ---
According to this talk:
http://forum.dlang.org/thread/ohctkdnupmbprglobwtc@forum.dlang.org#post-axonofactkyzpagilcbm:40forum.dlang.org

The spec does NOT state it should work that way.

Even if it did:
- Doing it this way buys nothing, as you get the same result simply by... not
typing the block
- Is bug prone (accidental labeling)
- Potentially creates different behavior from C code.

NB: The original example is wrong because of shadowing. But this one is more
viable.

//----
void main()
{
    {
        uint foo;
    } end_first_block:

    {
        uint foo;
    } end_second_block:

    {
        uint foo; //main.d(12): Error: declaration main.main.foo is already
defined
    } end_third_block:

    return;
}
//----

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