public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "antonbachin at yahoo dot com" <gcc-bugzilla@gcc.gnu.org> 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 [thread overview] Message-ID: <bug-57607-4@http.gcc.gnu.org/bugzilla/> (raw) 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 <cstdlib> #import <iostream> #import <Foundation/NSString.h> 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: '<expression 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.
next reply other threads:[~2013-06-13 17:57 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2013-06-13 17:57 antonbachin at yahoo dot com [this message] 2015-09-07 14:36 ` [Bug objc++/57607] " dougmencken at gmail dot com 2015-09-07 15:04 ` redi at gcc dot gnu.org 2015-09-08 2:37 ` dougmencken at gmail dot com
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-57607-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: linkBe 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).