[Bug c++/53549] [4.7/4.8 Regression] g++ and armadillo 3.2.0, operator() is inaccessible
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Jun 12 10:33:00 GMT 2012
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53549
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |fabien at gcc dot gnu.org
--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-06-12 10:33:26 UTC ---
I *think* this is equivalent:
template<typename T>
class M
{
public:
int operator()(unsigned);
};
template<typename T>
class C : public M<T>
{
public:
using M<T>::operator();
int operator()();
template<int I>
class F : public C<T>
{
public:
using C<T>::operator();
};
};
int main()
{
C<int>::F<2> f;
f();
}
using.cc: In instantiation of 'class C<int>::F<2>':
using.cc:29:18: required from here
using.cc:14:9: error: 'int C<T>::operator()()' is inaccessible
int operator()();
^
using.cc:18:15: error: within this context
class F : public C<T>
^
There's only one "inaccesible" error because ther's only one operator()
overload in the reduced example, ading a const overload (as in the original)
gives two "inaccessible" errors.
This looks like another "using" issue, CC'ing Fabien.
N.B. Clang++ accepts the example above, but Comeau online rejects this because
C<T>::F uses C<T> before it is complete. I think Comeau is correct.
Moving the definition of F to a point when C<T> is complete is acepted by
Comeau and Clang and older G++ versions but gives a different error with G++
trunk:
template<typename T>
class M
{
public:
int operator()(unsigned);
};
template<typename T>
class C : public M<T>
{
public:
using M<T>::operator();
int operator()();
template<int I> class F;
};
template<typename T>
template<int I>
class C<T>::F : public C<T>
{
public:
using C<T>::operator();
};
int main()
{
C<int>::F<2> f;
f();
}
using.cc:26:30: error: no members matching 'C<T>::operator()' in 'class C<T>'
using C<T>::operator();
^
More information about the Gcc-bugs
mailing list