Bug Report: GCC 3.0.2
ST.ROSE Raymond
Raymond.STROSE@oami.eu.int
Wed Dec 5 06:57:00 GMT 2001
Dear FSF,
I have encountered an issue which I believe to be a bug. The C++
specification, the GCC documentation and FAQ have been consulted without any
indication as to why the following source should be invalid. Unfortunately,
our organisation is protected by a firewall that prevents consultation of
discussion groups that may contain relavant information.
The offending source is:
template <typename X> struct Reference { typedef X& Type; };
template <typename X> struct Reference<X&> { typedef X& Type; };
template <typename X>
class A
{
// Datatypes
public:
typedef typename Reference<X>::Type Ref;
typedef const Ref ConstRef;
// Construction/destruction
public:
inline A(void) {}
explicit inline A(ConstRef x) : _value(x) {}
// Attributes
private:
X _value;
}; // End of class A
int
main(const int, const char**, const char**)
{
const int i = 100;
A<int> a(i);
A<int&> b(i);
return 0;
} // End of main
Passing the above program through GCC results in the following errors:
g++ main.cpp
main.cpp: In function `int main(int, const char**, const char**)':
main.cpp:35: no matching function for call to `A<int>::A(const
int&)'
main.cpp:7: candidates are: A<int>::A(const A<int>&)
main.cpp:20: A<X>::A(typename Reference<X>::Type)
[with X =
int]
main.cpp:19: A<X>::A() [with X = int]
main.cpp:36: no matching function for call to `A<int&>::A(const
int&)'
main.cpp:7: candidates are: A<int&>::A(const A<int&>&)
main.cpp:20: A<X>::A(typename Reference<X>::Type)
[with X =
int&]
main.cpp:19: A<X>::A() [with X = int&]
(Please note that the const qualifier appears to have been stripped from the
constructor's argument list).
Details of the build system:
* gcc -v
Reading specs from /usr/lib/gcc-lib/sparc-sun-solaris2.8/3.0.2/specs
Configured with: ./configure --prefix=/usr : (reconfigured)
./configure --prefix=/usr
Thread model: posix
gcc version 3.0.2
* The system is a Sun Ultra 60 (dual UltraSPARC-II @ 450MHz)
Due to this being a new development, we are unable to determine whether this
is new behaviour or whether the fault lies within our code. But, as the
issue prevents further progress in our development (until a solution or
work-around is found), I would very much appreciate a high priority on the
bug. However, I realise that our priorities may not be in line with those of
the GCC project!
I would like to take this opportunity to congratulate the FSF and the GCC
development team for such an excellent product.
If any further information should be required, please do not hesitate to
contact me.
Regards,
Raymond St.Rose
More information about the Gcc-bugs
mailing list