[Bug c++/24630] New: friend injection fails

igodard at pacbell dot net gcc-bugzilla@gcc.gnu.org
Wed Nov 2 02:06:00 GMT 2005


template<typename T>
struct  foo {
    template<typename U>
    friend
    foo<T>  f1(U u) {}

    template<typename TT, typename U>
    friend
    foo<TT> f2(U u) {}
    };
int main  () {
    bool b;
    f1<int>(b);
    f2<int>(b);
    }


gets you:

~/ootbc/members/src$ g++ foo.cc
foo.cc: In function `int main()':
foo.cc:13: error: `f1' undeclared (first use this function)
foo.cc:13: error: (Each undeclared identifier is reported only once for each
function it appears in.)
foo.cc:13: error: expected primary-expression before "int"
foo.cc:13: error: expected `;' before "int"
foo.cc:14: error: `f2' undeclared (first use this function)
foo.cc:14: error: expected primary-expression before "int"
foo.cc:14: error: expected `;' before "int"


Ivan


-- 
           Summary: friend injection fails
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: igodard at pacbell dot net


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



More information about the Gcc-bugs mailing list