Bug 15410 - Wrong template signature accepted in friend declaration
Summary: Wrong template signature accepted in friend declaration
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 3.4.0
: P2 normal
Target Milestone: 4.0.0
Assignee: Kriang Lerdsuwanakij
URL:
Keywords: accepts-invalid, monitored, patch
Depends on:
Blocks: 12944 16995
  Show dependency treegraph
 
Reported: 2004-05-13 00:56 UTC by Ivan Godard
Modified: 2004-11-25 17:05 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail: 2.95.3 3.3.3 3.4.0 4.0.0 3.0.4 3.2.3
Last reconfirmed: 2004-08-12 06:51:14


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ivan Godard 2004-05-13 00:56:06 UTC
The following code compiles without error despite the template signature mismatch between the template declaration and the friend declaration.

template<typename T, typename U>
struct      F;
class       W {
    template<int i>
    friend
    class F;
    int x;
    };

template<typename T, typename U>
struct  F {
    void Look(W& w) { w.x = 3; }
    };

int main() {
    W w;
    F<char, bool> f;
    f.Look(w);
    return 0;
    }
Comment 1 Andrew Pinski 2004-05-13 01:00:24 UTC
Confirmed.
Comment 2 Kriang Lerdsuwanakij 2004-10-17 14:09:14 UTC
Patches submitted.  Both patches are required to fix this bug.

  http://gcc.gnu.org/ml/gcc-patches/2004-10/msg01321.html
  http://gcc.gnu.org/ml/gcc-patches/2004-10/msg01372.html
Comment 3 Kriang Lerdsuwanakij 2004-11-12 17:03:09 UTC
One more patch is required.  And libjava problem has to be fixed before this bug
is revisited.
Comment 4 Kriang Lerdsuwanakij 2004-11-25 17:05:33 UTC
Fixed in the mainline.