public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/60799] New: access checking within injected friend functions does not happen in the context of the enclosing class
@ 2014-04-09 20:24 eric.niebler at gmail dot com
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
0 siblings, 2 replies; 3+ messages in thread
From: eric.niebler at gmail dot com @ 2014-04-09 20:24 UTC (permalink / raw)
To: gcc-bugs
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)
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/60799] access checking within injected friend functions does not happen in the context of the enclosing class
2014-04-09 20:24 [Bug c++/60799] New: access checking within injected friend functions does not happen in the context of the enclosing class eric.niebler at gmail dot com
@ 2014-12-14 16:23 ` ville.voutilainen at gmail dot com
2021-08-10 2:40 ` pinskia at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: ville.voutilainen at gmail dot com @ 2014-12-14 16:23 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60799
Ville Voutilainen <ville.voutilainen at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |rejects-valid
Status|UNCONFIRMED |NEW
Last reconfirmed| |2014-12-14
CC| |ville.voutilainen at gmail dot com
Ever confirmed|0 |1
Known to fail| |4.8.2, 4.9.1, 5.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/60799] access checking within injected friend functions does not happen in the context of the enclosing class
2014-04-09 20:24 [Bug c++/60799] New: access checking within injected friend functions does not happen in the context of the enclosing class eric.niebler at gmail dot com
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
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-10 2:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60799
--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
GCC, ICC and MSVC all rejects this with is private error.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-08-10 2:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-09 20:24 [Bug c++/60799] New: access checking within injected friend functions does not happen in the context of the enclosing class eric.niebler at gmail dot com
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
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).