Bug 46159 - [4.5 Regression] Bogus warning about lambdas
Summary: [4.5 Regression] Bogus warning about lambdas
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.6.0
: P2 normal
Target Milestone: 4.5.3
Assignee: Jason Merrill
URL:
Keywords: rejects-valid
: 47651 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-10-24 22:08 UTC by Joseph S. Myers
Modified: 2011-03-02 18:48 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Known to work: 4.6.0
Known to fail: 4.5.2
Last reconfirmed: 2010-10-27 21:02:56


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Joseph S. Myers 2010-10-24 22:08:34 UTC
The following C++ code

void
f()
{
  int **p = new(int(*[2]));
}

gets what seems to be a bogus diagnostic from 4.5 and 4.6:

t.C: In function 'void f()':
t.C:4:21: warning: lambda expressions only available with -std=c++0x or -std=gnu++0x [enabled by default]

As far as I know this is valid C++98/C++03 code, not involving a lambda.  4.4 accepts it with no diagnostic.
Comment 1 Andrew Pinski 2010-10-27 21:02:56 UTC
Confirmed.  Looks like there might be some ambiguous in the parsing with lambda's.
Comment 2 Richard Biener 2010-12-16 13:03:23 UTC
GCC 4.5.2 is being released, adjusting target milestone.
Comment 3 Andrew Pinski 2011-02-08 22:31:12 UTC
*** Bug 47651 has been marked as a duplicate of this bug. ***
Comment 4 Jason Merrill 2011-03-02 18:18:48 UTC
Author: jason
Date: Wed Mar  2 18:18:41 2011
New Revision: 170621

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=170621
Log:
	PR c++/46159
	* parser.c (cp_parser_primary_expression): Don't warn about a
	failed tentative parse.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-98.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/parser.c
    trunk/gcc/testsuite/ChangeLog
Comment 5 Jakub Jelinek 2011-03-02 18:22:45 UTC
Fixed on the trunk so far.
Comment 6 Jason Merrill 2011-03-02 18:46:04 UTC
Author: jason
Date: Wed Mar  2 18:46:01 2011
New Revision: 170622

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=170622
Log:
	PR c++/46159
	* parser.c (cp_parser_primary_expression): Don't warn about a
	failed tentative parse.

Added:
    branches/gcc-4_5-branch/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-98.C
Modified:
    branches/gcc-4_5-branch/gcc/cp/ChangeLog
    branches/gcc-4_5-branch/gcc/cp/parser.c
    branches/gcc-4_5-branch/gcc/testsuite/ChangeLog
Comment 7 Jason Merrill 2011-03-02 18:48:04 UTC
Fixed in 4.5 as well.