Thread overview | |||||
---|---|---|---|---|---|
|
October 08, 2010 [dmd-internals] dmd commit, revision 707 | ||||
---|---|---|---|---|
| ||||
dmd commit, revision 707 user: walter msg: fix gcc spurious warning http://www.dsource.org/projects/dmd/changeset/707 |
October 07, 2010 [dmd-internals] dmd commit, revision 707 | ||||
---|---|---|---|---|
| ||||
Posted in reply to dsource.org | On 10/7/2010 10:35 PM, dsource.org wrote:
> dmd commit, revision 707
>
>
> user: walter
>
> msg:
> fix gcc spurious warning
>
> http://www.dsource.org/projects/dmd/changeset/707
Error, not warning.
I was curious enough to do some digging. Here's the relevant snippet.. quite possibly not a direct quote, but repeated several times across several different websites.
============
The reason is that such jump is a scoping violation. C++ standard paragraph 6.7.3:
It is possible to transfer into a block, but not in a way that bypasses declarations with initialization. A program that jumps (77) from a point where a local variable with automatic storage duration is not in scope to a point where it is in scope is ill-formed unless the variable has POD type (3.9) and is declared without an initializer (8.5).
77) The transfer from the condition of a switch statement to a case label is
considered a jump in this respect.
============
So, based on that, it's neither spurious nor a bug in gcc. That dmd accepts it seems to be a bug. :)
Later,
Brad
|
October 08, 2010 [dmd-internals] dmd commit, revision 707 | ||||
---|---|---|---|---|
| ||||
Posted in reply to Brad Roberts |
Brad Roberts wrote:
>
> Error, not warning.
>
> I was curious enough to do some digging. Here's the relevant snippet.. quite possibly not a direct quote, but repeated several times across several different websites.
>
> ============
> The reason is that such jump is a scoping violation. C++ standard paragraph 6.7.3:
>
> It is possible to transfer into a block, but not in a way that bypasses declarations with initialization. A program that jumps (77) from a point where a local variable with automatic storage duration is not in scope to a point where it is in scope is ill-formed unless the variable has POD type (3.9) and is declared without an initializer (8.5).
>
> 77) The transfer from the condition of a switch statement to a case label is
> considered a jump in this respect.
> ============
>
> So, based on that, it's neither spurious nor a bug in gcc. That dmd accepts it seems to be a bug. :)
>
>
Except that there is no possible way any jump or case statement can bypass the initialization of peekt and refer to it.
|
Copyright © 1999-2021 by the D Language Foundation