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++/15625] [3.4/3.5 Regression] friend defined inside a template fails to find static function


------- Additional Comments From bangerth at dealii dot org  2004-05-24 13:57 -------
Here is something slightly smaller: 
------------------- 
template <typename T> struct S { 
    static void foo(const S&); 
    friend void bar(const S& s) { foo(s); } 
}; 
 
int main() { 
    S<int> a; bar(a); 
} 
------------------ 
 
Although all prior versions of gcc before 3.4 and icc in strict mode 
accept this code, I am a little puzzled why this is so: bar() is just 
a friend, not a member, why should it look inside struct S to find the 
static function? Why don't I have to qualify foo as S::foo? 
 
Alas, that isn't the problem, from the error message gcc gives, it 
is pretty obvious that gcc just gets somehow confused about templates 
in this case. 
 
W. 

-- 


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


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