c++/10497: Bug #909 not closed : Spurious error using nested classes in constructor calls

have@ann.jussieu.fr have@ann.jussieu.fr
Fri Apr 25 14:54:00 GMT 2003


>Number:         10497
>Category:       c++
>Synopsis:       Bug #909 not closed : Spurious error using nested classes in constructor calls
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Apr 25 13:26:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     have@ann.jussieu.fr
>Release:        2.95, 3.0, 3.2, 3.3
>Organization:
>Environment:
Linux
>Description:
Bug #909 does not seem to be fixed even if it is closed.
With g++ > 3.0, the error becomes:
" error: type specifier omitted for parameter `Z' "
>How-To-Repeat:
// Just compile this code
 class A {
     public:
         struct Nested { Nested(int i) {} };
         
         A(const Nested &n, int *p=0) { }
 };
 
 class B {
     public:
         B(const A::Nested &n, int *p=0) { }
         B(const A &a, int *p=0) { }
 };
 
 int main(void)
 {   
     int *Z=0;
     int i=1;
     A a(A::Nested(i), Z);      // ERROR:  type specifier omitted for parameter
     A b(A::Nested(int(i)), Z); // ERROR:  type specifier omitted for parameter
     A c(A::Nested((int)i), Z); // OK
     A d(A::Nested(1), Z);      // OK
     A e(A::Nested(i));         // OK
     A f(i, Z);                 // OK
     
     B g(A::Nested(i), Z);      // ERROR:  type specifier omitted for parameter
     B h(i, Z);                 // OK
 }
 
 
>Fix:

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



More information about the Gcc-bugs mailing list