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++/14002] New: [3.4/3.5 regression] Friend declaration with template-id causes confusion of function arguments


Here's a valid code snippet inspired by PR 13995:

==============================================================
template <typename T> void foo (T x) { x; }

void bar() { foo(0); }

struct A
{
    friend void foo<int> (int);
};
==============================================================

The code is wrongfully rejected by gcc 2.95.x - 3.2.3.
The bug was fixed in gcc 3.3. (So far everything looks like in PR 13995.)

Alas, this bug reappered in gcc 3.4/mainline. :-(

Btw, the error message reads:
bug.cc: In function `void foo(T) [with T = int]':
bug.cc:3:   instantiated from here
bug.cc:1: error: `x' undeclared (first use this function)
bug.cc:1: error: (Each undeclared identifier is reported only once for each
function it appears in.)

-- 
           Summary: [3.4/3.5 regression] Friend declaration with template-id
                    causes confusion of function arguments
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: reichelt at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org,heinlein at informatik
                    dot uni-ulm dot de


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


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