[Bug c++/41518] New: copy initialization of volatile objects
Dear all, I would like to post a fault report for the GNU C/C++ compiler 4.3.0. Used invokation line for the GNU C++ compiler: gcc -c -x c++ -ansi -Wall -Werror -mcpu=603e -fverbose-asm -mbig -mmultiple -mstring -mstrict-align -meabi -msdata -fno-common -fno-exceptions -fno-rtti -O3 -fno-section-anchors -Idifferent include paths -Ddifferent #define's X.CPP -oX.O // example program struct X { X (void*); }; int i; volatile X ax1(i); volatile X ax2 = i; // --- line 9 const volatile X bx1(i); const volatile X bx2 = i; // --- line 12 GNU rejects the code fragment with the following error messages: X.CPP:9: error: no matching function for call to 'X::X(volatile X)' X.CPP:3: note: candidates are: X::X(void*) X.CPP:2: note: X::X(const X) X.CPP:12: error: no matching function for call to 'X::X(const volatile X)' X.CPP:3: note: candidates are: X::X(void*) X.CPP:2: note: X::X(const X) The initializations in lines 9 and 12 are copy-initializations with a call to the converting constructor X::X (void*). The result of this call is a temporary of type X (and not of type [const] volatile X), which can be copied with the implicitly-generated copy constructor X::X (const X). BTW, the Comeau online compiler accepts the code above. Kind regards W. Roehrl -- Summary: copy initialization of volatile objects Product: gcc Version: 4.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: wolfgang dot roehrl at gi-de dot com GCC build triplet: athlon-redhat-linux GCC host triplet: i686-pc-mingw32 GCC target triplet: powerpc-rtems4.9 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41518
[Bug c++/38541] New: function parameter type T(*)[]
Dear all, I would like to post a fault report for the GNU C/C++ compiler 4.3.0. Used invokation line for the GNU C++ compiler: gcc -c -x c++ -ansi -Wall -Werror -mcpu=603e -fverbose-asm -mbig -mmultiple -mstring -mstrict-align -meabi -msdata -fno-common -fno-exceptions -fno-rtti -O3 -fno-section-anchors -Idifferent include paths -Ddifferent #define's X.CPP -oX.O // example program template typename T_ bool f (T_* p); bool g () { return f(static_castint(*)[](0)); } GNU accepts the code frgment above which is illegal. It is illegal because a function parameter like int(*)[] is illegal (8.3.5/6). BTW, the Comeau online compiler rejects the code above. Kind regards W. Roehrl -- Summary: function parameter type T(*)[] Product: gcc Version: 4.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: wolfgang dot roehrl at gi-de dot com GCC build triplet: athlon-redhat-linux GCC host triplet: i686-pc-mingw32 GCC target triplet: powerpc-rtems4.9 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38541
[Bug c++/38542] New: placement new and name lookup in templates
Dear all, I would like to post a fault report for the GNU C/C++ compiler 4.3.0. Used invokation line for the GNU C++ compiler: gcc -c -x c++ -ansi -Wall -Werror -mcpu=603e -fverbose-asm -mbig -mmultiple -mstring -mstrict-align -meabi -msdata -fno-common -fno-exceptions -fno-rtti -O3 -fno-section-anchors -Idifferent include paths -Ddifferent #define's X.CPP -oX.O // example program template typename T_ T_* g (void* p) { return new(p) T_(); } void* operator new (unsigned int, void* p); int* h (void* p) { return gint(p); } GNU accepts the code frgment above which is illegal. It is illegal because . the name new in the body of function g() is a non-dependent name and non- dependent names are bound at the point they are used (14.6.3); . the new-expression in function g() is a placement-new-expression . only non-placement allocation functions are declared implicitly (3.7.3/2). BTW, the Comeau online compiler rejects the code above. Kind regards W. Roehrl -- Summary: placement new and name lookup in templates Product: gcc Version: 4.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: wolfgang dot roehrl at gi-de dot com GCC build triplet: athlon-redhat-linux GCC host triplet: i686-pc-mingw32 GCC target triplet: powerpc-rtems4.9 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38542
[Bug c++/38540] New: Type of 'const int f ()'
Dear all, I would like to post a fault report for the GNU C/C++ compiler 4.3.0. Used invokation line for the GNU C++ compiler: gcc -c -x c++ -ansi -Wall -Werror -mcpu=603e -fverbose-asm -mbig -mmultiple -mstring -mstrict-align -meabi -msdata -fno-common -fno-exceptions -fno-rtti -O3 -fno-section-anchors -Idifferent include paths -Ddifferent #define's X.CPP -oX.O // example program const int f (); template typename T_ void g (T_); void h (void) { g(f()); } GNU accepts the code fragment above which is illegal. It is illegal because . Function f() yields a rvalue (3.10/5); . the type of f() is int and not const int since only a class-type rvalue can be const-qualified (3.10/9); . so function g() should be instantiated as gint(int) in the expression g(f()); . the parameter int of function gint(int) cannot bind a non-const rvalue (8.5.3/5). BTW, the Comeau online compiler rejects the code above. Kind regards W. Roehrl -- Summary: Type of 'const int f ()' Product: gcc Version: 4.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: wolfgang dot roehrl at gi-de dot com GCC build triplet: athlon-redhat-linux GCC host triplet: i686-pc-mingw32 GCC target triplet: powerpc-rtems4.9 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38540
[Bug c++/31596] New: Internal compiler error (Segmentation fault)
Dear all, I would like to post a bug report for the GNU C/C++ compiler 3.3-e500. We use the compiler to generate code for a PowerPC processor. Used invokation line for the GNU C++ compiler: ccppc -c -x c++ -ansi -Wall -Werror -mcpu=8540 -fverbose-asm -mbig -fmerge-templates -mmultiple -mno-string -mstrict-align -O3 -fno-exceptions -fno-rtti -fno-builtin-printf -Isome include paths -Dsome #define's X.CPP -oX.O // file X.CPP template typename, typename class XXX; template typename, bool struct enaFunc; template typename T_ struct enaFuncT_,true { typedef T_ type; }; template typename T_ struct enaFuncT_,false {}; template typename T_ struct isXXX { typedef char NO; typedef char YES[2]; template typename U_, typename V_ static YES check (const XXXU_,V_*); static NO check (...); enum { value = (sizeof(check(static_castT_*(0))) == sizeof(YES)) }; }; template typename V_, typename U1_, typename U2_ typename enaFunctypename V_::T_RET_TYPE, (isXXXU1_::value isXXXU2_::value) ::type func (V_, U1_, U2_); // function #1 template typename V_, typename U1_, typename U2_ typename enaFunctypename V_::T_RET_TYPE, (isXXXU1_::value isXXXU2_::value) ::type func (const V_, U1_, U2_);// function #2 struct YYY { typedef int T_RET_TYPE; }; void f (const XXXint,char p1, const XXXbool,int p2) { const YYY f = YYY(); func (f, p1, p2);// --- line 49 } The compiler crashes with the following message: X.CPP: In function `void f(const XXXint, char, const XXXbool, int)': X.CPP:49: internal compiler error: Segmentation fault (Comeau online compiles the code fragment fine.) Kind regards W. Roehrl -- Summary: Internal compiler error (Segmentation fault) Product: gcc Version: 3.3 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: wolfgang dot roehrl at gi-de dot com GCC build triplet: sparc-sun-solaris2.5.1 GCC host triplet: i386-pc-mingw32 GCC target triplet: powerpc-wrs-vxworks http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31596
[Bug c++/31597] New: Unrecognized ambiguity in function overloading
Dear all, I would like to post a bug report for the GNU C/C++ compiler 3.3-e500. We use the compiler to generate code for a PowerPC processor. Used invokation line for the GNU C++ compiler: ccppc -c -x c++ -ansi -Wall -Werror -mcpu=8540 -fverbose-asm -mbig -fmerge-templates -mmultiple -mno-string -mstrict-align -O3 -fno-exceptions -fno-rtti -fno-builtin-printf -Isome include paths -Dsome #define's X.CPP -oX.O // file X.CPP template typename T_ T_ f1 (const T_* p) // function #1 { return p[1]; } template typename R_, typename T_ R_ f1 (const T_* p) // function #2 { return p[2]; } float f (const int* p) { return f1int(p); } // f1int(const int*) or // f1int,int(const int*) ? The compiler doesn't recognize that the call to f1() is ambiguous and it selects function #2. (BTW, Comeau online rejects the code fragment above.) Kind regards W. Roehrl -- Summary: Unrecognized ambiguity in function overloading Product: gcc Version: 3.3 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: wolfgang dot roehrl at gi-de dot com GCC build triplet: sparc-sun-solaris2.5.1 GCC host triplet: i386-pc-mingw32 GCC target triplet: powerpc-wrs-vxworks http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31597
[Bug c++/31042] New: Instantiation with const pointer to member
Dear all, I would like to post a bug report for the GNU C/C++ compiler 3.3-e500. We use the compiler to generate code for a PowerPC processor. Used invokation line for the GNU C++ compiler: ccppc -c -x c++ -ansi -Wall -Werror -mcpu=8540 -fverbose-asm -mbig -fmerge-templates -mmultiple -mno-string -mstrict-align -O3 -fno-exceptions -fno-rtti -fno-builtin-printf -Isome include paths -Dsome #define's X.CPP -oX.O // file X.CPP class X; template typename T_ int X::** f1 () { return static_castT_*(0); } int X::** f2 () { return f1int X::* const(); } The compiler gives the following error messages: X.CPP: In function `int X::** f1() [with T_ = int X::*]': X.CPP:6: instantiated from here X.CPP:4: error: invalid conversion from `int X::**' to `int X::**' BTW, function f1 is instantiated with 'T_ = int X::* const' and not with 'T_ = int X::*'. Kind regards W. Roehrl -- Summary: Instantiation with const pointer to member Product: gcc Version: 3.3 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: wolfgang dot roehrl at gi-de dot com GCC build triplet: sparc-sun-solaris2.5.1 GCC host triplet: i386-pc-mingw32 GCC target triplet: powerpc-wrs-vxworks http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31042
[Bug c++/28142] New: Template friend declaration and dependent names
Dear all, I would like to post a bug report for the GNU C/C++ compiler 3.3-e500. We use the compiler to generate code for a PowerPC processor. Used invokation line for the GNU C++ compiler: ccppc -c -x c++ -ansi -Wall -Werror -mcpu=8540 -fverbose-asm -mbig -fmerge-templates -mmultiple -mno-string -mstrict-align -O3 -fno-exceptions -fno-rtti -fno-builtin-printf -Isome include paths -Dsome #define's X.CPP -oX.O // file X.CPP template typename T_ struct S { struct B; }; class C { template typename T_ friend struct ST_::B; // --- line 10 }; The compiler gives the following error message: X.CPP:10: warning: `ST_::B' is implicitly a typename X.CPP:10: warning: implicit typename is deprecated, please see the documentation for details X.CPP:10: error: typename type `ST_::B' declared `friend' According to 14.5.3/6 the compiler should accept the code above. Kind regards W. Roehrl -- Summary: Template friend declaration and dependent names Product: gcc Version: 3.3 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: wolfgang dot roehrl at gi-de dot com GCC build triplet: sparc-sun-solaris2.5.1 GCC host triplet: i386-pc-mingw32 GCC target triplet: powerpc-wrs-vxworks http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28142
[Bug c++/27483] New: Pointer to protected member
Dear all, I would like to post a bug report for the GNU C/C++ compiler 3.3-e500. We use the compiler to generate code for a PowerPC processor. Used invokation line for the GNU C++ compiler: ccppc -c -x c++ -ansi -Wall -Werror -mcpu=8540 -fverbose-asm -mbig -fmerge-templates -mmultiple -mno-string -mstrict-align -O3 -fno-exceptions -fno-rtti -fno-builtin-printf -Isome include paths -Dsome #define's X.CPP -oX.O // file X.CPP struct B { protected: void f (int); }; void g (void (B::*)(int)); struct D : B { void h1 () const { g (B::f); }// --- line 11 (illegal) void h2 () const { g (D::f); }// --- line 12 (legal) }; The compiler ignores that line 11 is illegal with respect to 11.5/1: If the access is to form a pointer to member, the nested-name-specifier shall name the derived class (or any class derived from that class). Kind regards W. Roehrl -- Summary: Pointer to protected member Product: gcc Version: 3.3 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: wolfgang dot roehrl at gi-de dot com GCC build triplet: sparc-sun-solaris2.5.1 GCC host triplet: i386-pc-mingw32 GCC target triplet: powerpc-wrs-vxworks http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27483
[Bug c++/26799] New: Type deduction of a pointer-to-member
Dear all, I would like to post a bug report for the GNU C/C++ compiler 3.3-e500. We use the compiler to generate code for a PowerPC processor. Used invokation line for the GNU C++ compiler: ccppc -c -x c++ -ansi -Wall -Werror -mcpu=8540 -fverbose-asm -mbig -fmerge-templates -mmultiple -mno-string -mstrict-align -O3 -fno-exceptions -fno-rtti -fno-builtin-printf -Isome include paths -Dsome #define's X.CPP -oX.O // file X.CPP void g (void*); struct ABC { template typename T_, typename U_ ABC (void (T_::* ptrFunc)(), U_ refObj) { T_* pObj = refObj; g (pObj); // --- line 9 } }; struct DEF { void f () const; }; DEF def; ABC abc(DEF::f, def); The compiler gives the following error message: X.CPP: In constructor `ABC::ABC(void (T_::*)(), U_) [with T_ = const DEF, U_ = DEF]': X.CPP:19: instantiated from here X.CPP:9: error: invalid conversion from `const void*' to `void*' The compilation of the code above fails but for a wrong reason: it should fail because the pointer to function f has type 'void (DEF::*)() const' and there is no constructor available whose first parameter fits the mentioned type. But the GNU compiler erronously deduces the type 'void (const DEF::*)()' for the first constructor parameter as the error message shows. Kind regards W. Roehrl -- Summary: Type deduction of a pointer-to-member Product: gcc Version: 3.3 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: wolfgang dot roehrl at gi-de dot com GCC build triplet: sparc-sun-solaris2.5.1 GCC host triplet: i386-pc-mingw32 GCC target triplet: powerpc-wrs-vxworks http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26799
[Bug c++/26332] New: Pointer to pointer-to-member
Dear all, I would like to post a bug report for the GNU C/C++ compiler 3.3-e500. We use the compiler to generate code for a PowerPC processor. Used invokation line for the GNU C++ compiler: ccppc -c -x c++ -ansi -Wall -Werror -mcpu=8540 -fverbose-asm -mbig -fmerge-templates -mmultiple -mno-string -mstrict-align -O3 -fno-exceptions -fno-rtti -fno-builtin-printf -Idifferent include paths -Ddifferen #define's X.CPP -oX.O // file X.CPP class C; typedef int C::* T1; const T1* f (const void* p) { return static_castconst T1*(p); // --- line 7 } The compiler gives the following error message: X.CPP: In function `int C::** f(const void*)': X.CPP:7: error: static_cast from type `const void*' to type `int C::**' casts away constness The compiler seems to take the type const T1* incorrectly as int C::** and not as int C::* const *. Kind regards W. Roehrl -- Summary: Pointer to pointer-to-member Product: gcc Version: 3.3 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: wolfgang dot roehrl at gi-de dot com GCC build triplet: sparc-sun-solaris2.5.1 GCC host triplet: i386-pc-mingw32 GCC target triplet: powerpc-wrs-vxworks http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26332
[Bug c++/26030] New: C-style casts and function-style casts
Dear all, I would like to post a bug report for the GNU C/C++ compiler 3.3-e500. We use the compiler to generate code for a PowerPC processor. Used invokation line for the GNU C++ compiler: ccppc -c -x c++ -ansi -Wall -Werror -mcpu=8540 -fverbose-asm -mbig -fmerge-templates -mmultiple -mno-string -mstrict-align -O3 -fno-exceptions -fno-rtti -fno-builtin-printf -Idifferent include paths -Ddifferen #define's X.CPP -oX.O // file X.CPP void f (int); typedef int* I; I f0 () { return static_castI(f); } --- line 5 I f1 () { return reinterpret_castI(f); }--- line 7 I f2 () { return (I)f; } // cast notation I f3 () { return I(f); } // functional notation The compiler gives the following error messages: X.CPP: In function `int* f0()': X.CPP:5: error: invalid static_cast from type `void ()(int)' to type `int*' X.CPP: In function `int* f1()': X.CPP:7: error: ISO C++ forbids casting between pointer-to-function and pointer-to-object I think the compiler should also reject the casts in f2() and f3(): - 5.4/5 states that the cast notation of explicit conversion performs only the conversions of a const_cast, of a static_cast, of reinterpret_cast and of certain combinations of those casts. - 5.2.3/1 says that cast in f3() is equivalent to the cast in f2(). Kind regards W. Roehrl -- Summary: C-style casts and function-style casts Product: gcc Version: 3.3 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: wolfgang dot roehrl at gi-de dot com GCC build triplet: sparc-sun-solaris2.5.1 GCC host triplet: i386-pc-mingw32 GCC target triplet: powerpc-wrs-vxworks http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26030
[Bug c++/25994] New: Using declarations and base function overloading
Dear all, I would like to post a bug report for the GNU C/C++ compiler 3.3-e500. We use the compiler to generate code for a PowerPC processor. Used invokation line for the GNU C++ compiler: ccppc -c -x c++ -ansi -Wall -Werror -mcpu=8540 -fverbose-asm -mbig -fmerge-templates -mmultiple -mno-string -mstrict-align -O3 -fno-exceptions -fno-rtti -fno-builtin-printf -Idifferent include paths -Ddifferen #define's X.CPP -oX.O // file X.CPP struct B1 { void f (char); void f (double); }; struct B2 { void f (int); void f (double); // --- line 10 }; struct D : public B1, public B2 { using B1::f; using B2::f; void g () { f ('a'); // should call B1::f(char) f (33);// should call B2::f(int) } }; The compiler gives the following error message: X.CPP:10: error: `void B2::f(double)' and `void B1::f(double)' cannot be overloaded I think this is not standard conforming. See 7.3.3/12: [ Note: two using declarations may introduce functions with the same name and the same parameter types. If, for a call to an unqualified function name, function overload resolution selects the functions introduced by such using declarations, the function call is illformed. ] Kind regards W. Roehrl -- Summary: Using declarations and base function overloading Product: gcc Version: 3.3 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: wolfgang dot roehrl at gi-de dot com GCC build triplet: sparc-sun-solaris2.5.1 GCC host triplet: i386-pc-mingw32 GCC target triplet: powerpc-wrs-vxworks http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25994
[Bug c++/25940] New: multiple definitions of extern C functions
Dear all, I would like to post a bug report for the GNU C/C++ compiler 3.3-e500. We use the compiler to generate code for a PowerPC processor. Used invokation line for the GNU C++ compiler: ccppc -c -x c++ -ansi -Wall -Werror -mcpu=8540 -fverbose-asm -mbig -fmerge-templates -mmultiple -mno-string -mstrict-align -O3 -fno-exceptions -fno-rtti -fno-builtin-printf -Idifferent include paths -Ddifferen #define's X.CPP -oX.O // file X.CPP namespace N1 { extern C int func (int); } namespace N2 { extern C int func (int); } namespace N3 { extern C int func (int); int func (int i) { return i * 2; }// --- definition of func() } int N1::func (int i) { return i / 2; }// --- func() already defined! namespace N2 { int func (int i) { return i + 2; }// --- func() already defined! } The compiler accepts this program and generates illegal assembler code: the label 'func' is defined three times as a global symbol. According to 7.5/6 the compiler should reject the program since func() is defined three times (see also 7.3.4/4). Kind regards W. Roehrl -- Summary: multiple definitions of extern C functions Product: gcc Version: 3.3 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: wolfgang dot roehrl at gi-de dot com GCC build triplet: sparc-sun-solaris2.5.1 GCC host triplet: i386-pc-mingw32 GCC target triplet: powerpc-wrs-vxworks http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25940