This is the mail archive of the gcc@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]

Re: reference template parameters


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.


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