public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "arthur.j.odwyer at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/61358] New: Bogus "duplicate label" error after label used within C++11 lambda
Date: Thu, 29 May 2014 18:08:00 -0000	[thread overview]
Message-ID: <bug-61358-4@http.gcc.gnu.org/bugzilla/> (raw)

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.


                 reply	other threads:[~2014-05-29 18:08 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-61358-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).