From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17143 invoked by alias); 13 Jun 2013 17:57:05 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 17121 invoked by uid 48); 13 Jun 2013 17:57:00 -0000 From: "antonbachin at yahoo dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug objc++/57607] New: g++ cannot distinguish obj-c message call from c++11 lambda Date: Thu, 13 Jun 2013 17:57:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: objc++ X-Bugzilla-Version: 4.8.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: antonbachin at yahoo dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2013-06/txt/msg00696.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57607 Bug ID: 57607 Summary: g++ cannot distinguish obj-c message call from c++11 lambda Product: gcc Version: 4.8.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: objc++ Assignee: unassigned at gcc dot gnu.org Reporter: antonbachin at yahoo dot com The following program (test.mm) has both a lambda and a message call: #import #import #import int main() { [] () { std::cout << "Hello world!" << std::endl; }(); std::cout << [@"Hello world!" UTF8String] << std::endl; return EXIT_SUCCESS; } Compiling with gcc 4.8.1 results in: > g++-mp-4.8 -std=c++11 test.mm && ./a.out test.mm: In function 'int main()': test.mm:8:6: error: expected identifier before ']' token [] () { std::cout << "Hello world!" << std::endl; }(); ^ test.mm:8:6: error: '' is not an Objective-C class name or alias test.mm:8:6: error: objective-c++ message argument(s) are expected before ']' token test.mm:8:11: error: expected ';' before '{' token [] () { std::cout << "Hello world!" << std::endl; }(); ^ test.mm:8:57: error: expected primary-expression before ')' token [] () { std::cout << "Hello world!" << std::endl; }(); ^ (I know that this wouldn't link, but I'm not getting that far). Meanwhile, with clang: > clang++ -std=c++11 -framework Foundation test.mm && ./a.out Hello world! Hello world! Version information: > g++-mp-4.8 --version g++-mp-4.8 (MacPorts gcc48 4.8.1_0) 4.8.1 Copyright (C) 2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. > clang++ --version Apple clang version 4.0 (tags/Apple/clang-421.0.60) (based on LLVM 3.1svn) Target: x86_64-apple-darwin12.4.0 Thread model: posix Compiling with -Wall -Wextra makes no difference in the output for either compiler.