public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "thakis at chromium dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/59165] New: gcc looks up begin(), end() for for-range loops for ints in namespace std
Date: Mon, 18 Nov 2013 04:13:00 -0000 [thread overview]
Message-ID: <bug-59165-4@http.gcc.gnu.org/bugzilla/> (raw)
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59165
Bug ID: 59165
Summary: gcc looks up begin(), end() for for-range loops for
ints in namespace std
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: thakis at chromium dot org
This compiles, but shouldn't:
$ cat gcc4.8bug.cc
// builds with gcc4.8, but shouldn't
namespace std {
int* begin(int i) { return (int*)0; }
int* end(int i) { return (int*)0; }
}
int main() {
for (int a : 10) { }
}
$ gcc-4.8.1 -c gcc4.8bug.cc -std=c++11
# works
The standard says that begin() and end() for foreach loops should be looked up
in the associated namespace of the type of the expression (6.5.4p1)
"""otherwise, begin-expr and end-expr are begin(__range) and end(__range),
respectively, where begin and end are looked up in the associated namespaces
(3.4.2). [ Note: Ordinary unqualified lookup (3.4.1) is not performed. — end
note ]"""
10 has type int, which is a fundamental type, and hence doesn't have an
associated namespace. So this shouldn't compile. (It doesn't compile in clang.)
$ gcc-4.8.1 --version
gcc-4.8.1 (GCC) 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.
>From gcc-bugs-return-434828-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Mon Nov 18 04:46:31 2013
Return-Path: <gcc-bugs-return-434828-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 310 invoked by alias); 18 Nov 2013 04:46:30 -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 32732 invoked by uid 48); 18 Nov 2013 04:46:25 -0000
From: "dongsheng.song at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/57897] Target x86_64-w64-mingw32 failed with '-mno-fentry isn't compatible with SEH'
Date: Mon, 18 Nov 2013 04:46:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c++
X-Bugzilla-Version: 4.9.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: dongsheng.song at gmail 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:
Message-ID: <bug-57897-4-nlG0qh4GK7@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-57897-4@http.gcc.gnu.org/bugzilla/>
References: <bug-57897-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: 2013-11/txt/msg01605.txt.bz2
Content-length: 682
http://gcc.gnu.org/bugzilla/show_bug.cgi?idW897
--- Comment #6 from Dongsheng Song <dongsheng.song at gmail dot com> ---
After revert r192062, I can build gcc smoothly.
$ svn log -r 192062
------------------------------------------------------------------------
r192062 | uros | 2012-10-04 13:53:22 +0800 (Thu, 04 Oct 2012) | 4 lines
* configure.ac (noexception_flags): Add -fasynchronous-unwind-tables.
* configure: Regenerate.
------------------------------------------------------------------------
2012-10-04 Uros Bizjak <ubizjak@gmail.com>
* configure.ac (noexception_flags): Add -fasynchronous-unwind-tables.
* configure: Regenerate.
next reply other threads:[~2013-11-18 4:13 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-18 4:13 thakis at chromium dot org [this message]
2013-11-18 10:28 ` [Bug c++/59165] " paolo.carlini at oracle dot com
2013-11-18 10:46 ` redi at gcc dot gnu.org
2013-11-18 10:56 ` redi at gcc dot gnu.org
2013-11-20 9:48 ` daniel.kruegler at googlemail dot com
2013-12-10 10:36 ` paolo.carlini at oracle dot com
2014-01-03 11:11 ` paolo at gcc dot gnu.org
2014-01-03 11:13 ` paolo.carlini at oracle 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-59165-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: link
Be 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).