public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/61358] New: Bogus "duplicate label" error after label used within C++11 lambda
@ 2014-05-29 18:08 arthur.j.odwyer at gmail dot com
  0 siblings, 0 replies; only message in thread
From: arthur.j.odwyer at gmail dot com @ 2014-05-29 18:08 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61358

            Bug ID: 61358
           Summary: Bogus "duplicate label" error after label used within
                    C++11 lambda
           Product: gcc
           Version: 4.8.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: arthur.j.odwyer at gmail dot com

cat >test.cc <<EOF
int main() {
  goto doit;
  []() { doit: ; };
  doit: ;
}
EOF
g++ -std=c++11 -c test.cc

test.cc: In function `int main()':
test.cc:2:8: error: label `doit' used but not defined
test.cc:5:1: error: duplicate label `doit'


Reproduces with 4.6.2, 4.6.4, and 4.8.1. I don't have 4.9 available to test
with.

The same thing happens if you use a statement-expression ({ doit: ; }); instead
of a C++11 lambda, but that might be not-a-bug. The C++11 issue is definitely a
bug.

If anyone still cares about Objective-C "blocks" in GCC, you might check for
the same issue with labels inside blocks.

This bug is actually important to us because we code-generate C++11 code, and
the code-generator wants to use the same labels for the same purposes whether
we happen to be inside a lambda or not.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-05-29 18:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-29 18:08 [Bug c++/61358] New: Bogus "duplicate label" error after label used within C++11 lambda arthur.j.odwyer at gmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).