This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: reference template parameters
- To: Alexandre Oliva <oliva at dcc dot unicamp dot br>
- Subject: Re: reference template parameters
- From: Andrey Slepuhin <pooh at msu dot ru>
- Date: Tue, 13 Jul 1999 13:54:20 +0400 (MEDT)
- Cc: egcs at egcs dot cygnus dot com
- Organization: Moscow State University Network (MSUnet)
On 13-Jul-99 Alexandre Oliva wrote:
> On Jul 8, 1999, Andrey Slepuhin <pooh@msu.ru> wrote:
>
>> Can anybody check whether template reference parameters work with
>> gcc-2.95?
>
>> With egcs-1.1.2 I got
>
>> test.cc:7: could not convert template argument `d' to `Base &'
>> test.cc:7: warning: ANSI C++ forbids declaration `yd' with no type
>
>> compiling example from C++ draft, clause 14.3.6.
>
> 14.3.6 doesn't exist in the final Standard. Are you trying to use a
> Derived lvalue as a Base& template parameter? The Standard does not
> allow any conversions for template parameters of type reference to
> object.
Really I mean that the following code:
-----------------------------------------
template <const int& b>
struct X
{
};
const int a=1;
X<a> x;
void main ()
{}
-----------------------------------------
fails with the following error under egcs 1.1.2:
test.cc:7: could not convert template argument `a' to `const int &'
test.cc:7: warning: ANSI C++ forbids declaration `x' with no type
If I understand C++ draft correctly, this is legal code, isn't it?
Or may be something is changed in final standard?
Andrey.