[Bug c++/67684] New: [concepts] friend access not working with constrained function
ryan.burn at gmail dot com
gcc-bugzilla@gcc.gnu.org
Tue Sep 22 18:54:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67684
Bug ID: 67684
Summary: [concepts] friend access not working with constrained
function
Product: gcc
Version: 6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: ryan.burn at gmail dot com
Target Milestone: ---
The following code fails to compile with g++ (GCC) 6.0.0 20150915
(experimental)
/////////////////////////////////
template<class T>
class A {
public:
template<int I, class S>
requires I > 0
friend int f(const A<S>&);
private:
int x = 2;
};
template<int I, class S>
requires I > 0
int f(const A<S>& a) {
return a.x;
}
int main() {
A<double> a;
f<2>(a);
return 0;
}
/////////////////////////////////
I get the error
main.cpp:14:12: error: ‘int A<double>::x’ is private within this context
But I expect it should be valid code (it compiles fine if the constraint is
removed)
More information about the Gcc-bugs
mailing list