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]

c++/2125: Namespaces are confused by forward-referencing typedefs



>Number:         2125
>Category:       c++
>Synopsis:       Namespaces are confused by forward-referencing typedefs
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Wed Feb 28 06:56:03 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     stephen.webb@cybersafe.com
>Release:        gcc version 3.0 20010219 (prerelease)
>Organization:
>Environment:

>Description:
The following code fragment 

// begin oink.cpp
namespace A {
  typedef class C C;
  typedef int T;
  class C { T i; };
}
// end oink.cpp

produces the following error when compiled with "gcc -c oink.cpp".

oink.cpp:4: syntax error before `;' token 

This code is accepted by gcc 2.95.2 and MSVC 12.00.8804.

Note that the following code is accepted.

// ... begin oink2.cpp
namespace A {
  typedef class C C;
  typedef int T;
  class C { A::T i; };
}
// ... end oink2.cpp

This example was distilled from preprocessed Solaris 8 system headers.

>How-To-Repeat:
See description.
>Fix:

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


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