Bug 39269 - Invalid template friend declaration accepted
Summary: Invalid template friend declaration accepted
Status: RESOLVED DUPLICATE of bug 43694
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.3.2
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: accepts-invalid
: 43960 (view as bug list)
Depends on:
Blocks:
 
Reported: 2009-02-23 03:27 UTC by Wolfgang Bangerth
Modified: 2013-07-01 09:13 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail: 2.95.3, 4.3.2
Last reconfirmed: 2009-02-23 09:58:27


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Wolfgang Bangerth 2009-02-23 03:27:12 UTC
This code has erroneously been accepted since at least gcc 2.95:
--------------------------
namespace NS {
  template <int A, int B> class X {};
}

class Y {
    template <int> friend class NS::X;
};
--------------------------
Note the wrong number of template arguments in the friend declaration.
The code is correctly rejected if X is not in a namespace.

W.
Comment 1 Richard Biener 2009-02-23 09:58:27 UTC
Confirmed.
Comment 2 Jonathan Wakely 2010-05-02 14:44:38 UTC
*** Bug 43960 has been marked as a duplicate of this bug. ***
Comment 3 Paolo Carlini 2013-07-01 09:13:46 UTC
Dup.

*** This bug has been marked as a duplicate of bug 43694 ***