This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/48884] New: decltype's operand doesn't consider friend declaration
- From: "boostcpp at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 5 May 2011 12:03:39 +0000
- Subject: [Bug c++/48884] New: decltype's operand doesn't consider friend declaration
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48884
Summary: decltype's operand doesn't consider friend declaration
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: boostcpp@gmail.com
decltype's operand doesn't consider friend declaration if it's used as a return
type of the function.
Following code failed.
class X
{
int value ;
friend class Y ;
} ;
class Y
{
public :
template < typename T >
static auto f(T t) -> decltype( t.value )
{
return t.value ; // OK. Y is a friend of X.
}
} ;
int main()
{
X x ;
Y::f(x) ; // gcc issues error
}
The error message is
In function 'int main()':
error: 'int X::value' is private
error: within this context
It looks like access checking is done in the main rather than Y::f<X>.