c++/5387: g++ fails to catch use of private type in template

Jason Merrill jason@prospero.cambridge.redhat.com
Tue Jan 15 05:16:00 GMT 2002


>Number:         5387
>Category:       c++
>Synopsis:       g++ fails to catch use of private type in template
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    unassigned
>State:          open
>Class:          accepts-illegal
>Submitter-Id:   net
>Arrival-Date:   Tue Jan 15 05:16:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Jason Merrill
>Release:        unknown-1.0
>Organization:
redhat
>Environment:
System: Linux prospero.cambridge.redhat.com 2.4.13-0.5 #1 Sat Nov 3 15:08:02 EST 2001 i686 unknown
Architecture: i686

	
>Description:
	In the testcase below, g++ fails to diagnose the use of B::X in the definition
of A<B>::x.
	
>How-To-Repeat:

  template <class T> struct A {
	  typename T::X x;
	  int f() { return T::i; }
  };

  class B {
	  typedef int X;
	  static int i;
  };

  int main()
  {
	  A<B> ab;
	  ab.f();
  }

>Fix:
	
>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the Gcc-bugs mailing list