Template problem
- From: "Jens Mander" <jens@xxxxxxxxxx>
- Date: Fri, 10 Nov 2006 23:58:31 +0100
The following code generates errors when compiled using VC++ 7.1. However,
gcc 3.2.2 and comeau online have no problems with it. Is this illegal code
or a compiler bug? If it is the latter; was it fixed in the latest release
of VC++? Are there any workarounds for my version?
Thank you in advance!
====================
template <typename T>
struct Outer
{
template <T value = 0>
struct Inner {};
};
int main ()
{
Outer<int>::Inner<> fail;
}
====================
cl test.cpp
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 13.10.3077 for 80x86
Copyright (C) Microsoft Corporation 1984-2002. All rights reserved.
test.cpp
test.cpp(10) : error C2976: 'Outer<T>::Inner' : too few template arguments
with
[
T=int
]
test.cpp(5) : see declaration of 'Outer<T>::Inner'
with
[
T=int
]
test.cpp(10) : error C2955: 'Outer<T>::Inner' : use of class template
requires t
emplate argument list
with
[
T=int
]
test.cpp(5) : see declaration of 'Outer<T>::Inner'
with
[
T=int
]
test.cpp(10) : error C2955: 'Outer<T>::Inner' : use of class template
requires t
emplate argument list
with
[
T=int
]
test.cpp(5) : see declaration of 'Outer<T>::Inner'
with
[
T=int
]
test.cpp(10) : error C2133: 'fail' : unknown size
test.cpp(10) : error C2512: 'Outer<T>::Inner' : no appropriate default
construct
or available
with
[
T=int
]
test.cpp(10) : error C2262: 'fail' : cannot be destroyed
.
- Follow-Ups:
- Re: Template problem
- From: John Carson
- Re: Template problem
- Prev by Date: Re: Trying to replace an MSVCRT strftime function
- Next by Date: Re: Is PGO (Profile Guided Optimization) incompatible with stl and /MD
- Previous by thread: Re: MS Visual C++ Help, what is MSDN all about?
- Next by thread: Re: Template problem
- Index(es):
Relevant Pages
|