public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "eric.niebler at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/60799] New: access checking within injected friend functions does not happen in the context of the enclosing class Date: Wed, 09 Apr 2014 20:24:00 -0000 [thread overview] Message-ID: <bug-60799-4@http.gcc.gnu.org/bugzilla/> (raw) http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60799 Bug ID: 60799 Summary: access checking within injected friend functions does not happen in the context of the enclosing class Product: gcc Version: 4.8.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: eric.niebler at gmail dot com The following compiles with clang, but not with gcc-4.8.2 ///////////////////////////////////////////// template<typename T> struct foo; template<typename T> struct bar { private: template<typename U> friend struct foo; int x_; public: bar() : x_(0) {} }; template<typename T> struct foo { private: int x_; public: foo() : x_(0) {} friend bool operator==(foo<T> f, bar<T> b) { return f.x_ == b.x_; } }; int main() { foo<int> f; bar<int> b; bool i = (f == b); } //////////////////////////////////////////////// Result: test.cpp: In instantiation of ‘bool operator==(foo<int>, bar<int>)’: test.cpp:32:18: required from here test.cpp:10:7: error: ‘int bar<int>::x_’ is private int x_; ^ test.cpp:24:19: error: within this context return f.x_ == b.x_; ^ >From gcc-bugs-return-448655-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed Apr 09 21:12:21 2014 Return-Path: <gcc-bugs-return-448655-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org> Delivered-To: listarch-gcc-bugs@gcc.gnu.org Received: (qmail 15492 invoked by alias); 9 Apr 2014 21:12:19 -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 15444 invoked by uid 48); 9 Apr 2014 21:12:14 -0000 From: "izamyatin at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/60467] ICE with -fcilkplus Date: Wed, 09 Apr 2014 21:12:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 4.9.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: izamyatin 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: cc Message-ID: <bug-60467-4-ZTjw63MnYn@http.gcc.gnu.org/bugzilla/> In-Reply-To: <bug-60467-4@http.gcc.gnu.org/bugzilla/> References: <bug-60467-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: 2014-04/txt/msg00675.txt.bz2 Content-length: 923 http://gcc.gnu.org/bugzilla/show_bug.cgi?id`467 Igor Zamyatin <izamyatin at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |izamyatin at gmail dot com --- Comment #2 from Igor Zamyatin <izamyatin at gmail dot com> --- I've also looked at this. I think this one should go diff --git a/gcc/c-family/cilk.c b/gcc/c-family/cilk.c index 6a7bf4f..bf549ad 100644 --- a/gcc/c-family/cilk.c +++ b/gcc/c-family/cilk.c @@ -99,7 +99,6 @@ cilk_set_spawn_marker (location_t loc, tree fcall) it. */ return false; else if (TREE_CODE (fcall) != CALL_EXPR - && TREE_CODE (fcall) != FUNCTION_DECL /* In C++, TARGET_EXPR is generated when we have an overloaded '=' operator. */ && TREE_CODE (fcall) != TARGET_EXPR)
next reply other threads:[~2014-04-09 20:24 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2014-04-09 20:24 eric.niebler at gmail dot com [this message] 2014-12-14 16:23 ` [Bug c++/60799] " ville.voutilainen at gmail dot com 2021-08-10 2:40 ` pinskia at gcc dot gnu.org
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-60799-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).