This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/56208] [4.8 Regression] Some classic sfinae cases fail to work


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56208

--- Comment #9 from Daniel KrÃgler <daniel.kruegler at googlemail dot com> 2013-02-05 19:09:15 UTC ---
Further data about the root of the problem: It seems actually to be an access
problem, the requirements for reproducing seem to be:

1) Some class B derives *privately* from a base class A

2) B refers to some function template f2 that refers to another dependent
function template f1 both in class scope of A (It doesn't matter whether these
function are actually public in A)

A reduced example is as follows:

//---------------------------
struct A {
   template<class T>
   static int f1();

   template<class T>
   static int f2(char(*)[sizeof(f1<T>())]);
};

struct B : private A {
   enum { value = sizeof(f2<int>(0)) };
};
//---------------------------

"Compilation finished with errors:
source.cpp:10:35: error: no matching function for call to 'B::f2(int)'
enum { value = sizeof(f2<int>(0)) };
^
source.cpp:10:35: note: candidate is:
source.cpp:6:15: note: template<class T> static int A::f2(char (*)[sizeof
(f1<T>())])
static int f2(char(*)[sizeof(f1<T>())]);
^
source.cpp:6:15: note: template argument deduction/substitution failed:
source.cpp: In substitution of 'template<class T> static int A::f2(char
(*)[sizeof (f1<T>())]) [with T = int]':
source.cpp:10:35: required from here
source.cpp:3:15: error: 'static int A::f1() [with T = int]' is inaccessible
static int f1();
^
source.cpp:6:39: error: within this context
static int f2(char(*)[sizeof(f1<T>())]);
^"


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]