public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug objc++/57607] New: g++ cannot distinguish obj-c message call from c++11 lambda
@ 2013-06-13 17:57 antonbachin at yahoo dot com
  2015-09-07 14:36 ` [Bug objc++/57607] " dougmencken at gmail dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: antonbachin at yahoo dot com @ 2013-06-13 17:57 UTC (permalink / raw)
  To: gcc-bugs

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.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug objc++/57607] g++ cannot distinguish obj-c message call from c++11 lambda
  2013-06-13 17:57 [Bug objc++/57607] New: g++ cannot distinguish obj-c message call from c++11 lambda antonbachin at yahoo dot com
@ 2015-09-07 14:36 ` 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
  2 siblings, 0 replies; 4+ messages in thread
From: dougmencken at gmail dot com @ 2015-09-07 14:36 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57607

Douglas Mencken <dougmencken at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dougmencken at gmail dot com

--- Comment #1 from Douglas Mencken <dougmencken at gmail dot com> ---
I confirm it: still here with 4.9.2

$ g++ -std=c++11 test.mm && ./a.out
test.mm: In function 'int main()':
test.mm:8:10: error: expected identifier before ']' token
         [] () { std::cout << "Hello world!" << std::endl; }();
          ^
test.mm:8:10: error: '<expression error>' is not an Objective-C class name or
alias
test.mm:8:10: error: objective-c++ message argument(s) are expected before ']'
token
test.mm:8:61: error: expected primary-expression before ')' token
         [] () { std::cout << "Hello world!" << std::endl; }();
                                                             ^
$ g++ --version | head -1
g++ (GCC) 4.9.2

Issue also causes errors like

/usr/include/c++/4.9.2/bits/hashtable.h:878:15: error: objective-c++ message
argument(s) are expected before ']' token
          [this](const __node_type* __n)

/usr/include/c++/4.9.2/bits/hashtable.h:916:17: error: objective-c++ message
argument(s) are expected before ']' token
         [&__roan](const __node_type* __n)


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug objc++/57607] g++ cannot distinguish obj-c message call from c++11 lambda
  2013-06-13 17:57 [Bug objc++/57607] New: g++ cannot distinguish obj-c message call from c++11 lambda antonbachin at yahoo dot com
  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
  2 siblings, 0 replies; 4+ messages in thread
From: redi at gcc dot gnu.org @ 2015-09-07 15:04 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57607

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Seems to be fixed in GCC 5 though:

l.mm: In function ‘int main()’:
l.mm:10:23: error: cannot find interface declaration for ‘NXConstantString’
         std::cout << [@"Hello world!" UTF8String] << std::endl;
                       ^
>From gcc-bugs-return-496546-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Mon Sep 07 15:26:27 2015
Return-Path: <gcc-bugs-return-496546-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 80279 invoked by alias); 7 Sep 2015 15:26:26 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 80241 invoked by uid 48); 7 Sep 2015 15:26:23 -0000
From: "izamyatin at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/66142] Loop is not vectorized because not sufficient support for GOMP_SIMD_LANE
Date: Mon, 07 Sep 2015 15:26:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: tree-optimization
X-Bugzilla-Version: 6.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: izamyatin at gmail dot com
X-Bugzilla-Status: REOPENED
X-Bugzilla-Resolution:
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: rguenth at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: cc
Message-ID: <bug-66142-4-Di1yHv5zNV@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-66142-4@http.gcc.gnu.org/bugzilla/>
References: <bug-66142-4@http.gcc.gnu.org/bugzilla/>
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: 2015-09/txt/msg00524.txt.bz2
Content-length: 443

https://gcc.gnu.org/bugzilla/show_bug.cgi?idf142

Igor Zamyatin <izamyatin at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |enkovich.gnu at gmail dot com

--- Comment #19 from Igor Zamyatin <izamyatin at gmail dot com> ---
Richard, would you be able to look at this in some time?


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug objc++/57607] g++ cannot distinguish obj-c message call from c++11 lambda
  2013-06-13 17:57 [Bug objc++/57607] New: g++ cannot distinguish obj-c message call from c++11 lambda antonbachin at yahoo dot com
  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
  2 siblings, 0 replies; 4+ messages in thread
From: dougmencken at gmail dot com @ 2015-09-08  2:37 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57607

--- Comment #3 from Douglas Mencken <dougmencken at gmail dot com> ---
(In reply to Jonathan Wakely from comment #2)
> Seems to be fixed in GCC 5 though:

Yep, 5.2 works:

$ g++-5.2 -std=gnu++11 -framework CoreFoundation -lobjc test.mm && ./a.out
Hello world!


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-09-08  2:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-13 17:57 [Bug objc++/57607] New: g++ cannot distinguish obj-c message call from c++11 lambda antonbachin at yahoo dot com
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

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