public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "frankhb1989 at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/56699] New: Failed for sizeof (non-static member) in lambda expression
Date: Sat, 23 Mar 2013 16:06:00 -0000	[thread overview]
Message-ID: <bug-56699-4@http.gcc.gnu.org/bugzilla/> (raw)


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56699

             Bug #: 56699
           Summary: Failed for sizeof (non-static member) in lambda
                    expression
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: frankhb1989@gmail.com


Here are the minimal testcases:

Case 1:

struct A
{
    int a;
};

struct T
{
    int x;

    T() : x([]{
        sizeof(::A::a);
        return 0;
    }())
    {}
};

Case 2:

struct A
{
    int a;
};

void f()
{
    []{sizeof(A::a);};
}

Tested at coliru.stacked-crooked.com (g++ -v shows it's a x86-64 linux host):

Case 1:
$ g++-4.8 -fsyntax-only -std=c++11 main.cpp
main.cpp: In lambda function:
main.cpp:11:15: error: type 'A' is not a base type for type 'T'
   sizeof(::A::a);
               ^
Case 2:
$ g++-4.8 -fsyntax-only -std=c++11 main.cpp
main.cpp: In lambda function:
main.cpp:10:15: internal compiler error: Segmentation fault
  []{sizeof(A::a);};
               ^

I have exactly the same errors for both cases using mingw-builds
4.8.0(i686-w64-mingw32) compiled today from sf.net on my Win7 x64 host.

>From some others, I've heard Case 1 is accepted by g++-4.8 compiled just now on
Ubuntu12.04, but the ICE still exists for Case 2.

G++ 4.7 accepts both cases.


             reply	other threads:[~2013-03-23 16:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-23 16:06 frankhb1989 at gmail dot com [this message]
2013-03-23 16:29 ` [Bug c++/56699] " frankhb1989 at gmail dot com
2013-03-25 21:23 ` [Bug c++/56699] [4.8/4.9 regression] " jason at gcc dot gnu.org

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-56699-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).