This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/52725] [4.7/4.8 Regression] error: "capture of non-variable" for new-expression incorrectly parsed as lambda-expression


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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-05-29
      Known to work|                            |4.1.2, 4.4.3, 4.6.3
            Summary|error: "capture of          |[4.7/4.8 Regression] error:
                   |non-variable" for           |"capture of non-variable"
                   |new-expression incorrectly  |for new-expression
                   |parsed as lambda-expression |incorrectly parsed as
                   |                            |lambda-expression
     Ever Confirmed|0                           |1

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-05-29 11:55:06 UTC ---
Anything to do with the cuda compiler is irrelevant here, this report is for a
GCC bug not for other programs, even if they generate code that triggers the
bug.

Anyway, I'm confirming this, here's a reduced testcase that produces a slightly
different eror, due to using a global instead of a data member:

struct A { };

extern int n;

void f()
{
    A** p = new (A*[n]);
}

Accepted by 4.6 and earlier, rejected by 4.7 and later

$ g++-4.7 -c t.cc
t.cc: In function 'void f()':
t.cc:7:21: warning: capture of variable 'n' with non-automatic storage duration
[enabled by default]
t.cc:3:5: note: 'int n' declared here


N.B. 4.5 says

t.cc: In function âvoid f()â:
t.cc:7:19: warning: lambda expressions only available with -std=c++0x or
-std=gnu++0x

But that was fixed for 4.6


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]