stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Sebor <>
Subject compilation errors in 25.count.cpp (was Re: Stdcxx test porting)
Date Thu, 17 Nov 2005 20:14:03 GMT
Anton Pevtsov wrote:
> As for the 25_count test I wrote the simple test and it failed to
> compile too. The test is attached (test_compile_fail.cpp). Moreover, the
> following code is not compileable:
> template<class U> struct Trait {typedef double result;}; template<class
> T> typename Trait<T>::result foo(); template<> typename
> Trait<int>::result foo<int>(); // Line causes errors.
> I guess that the test code meets the standard requirements. And it looks
> like a compiler bug. 

I believe so. I filed a bug with Microsoft with this test case:

$ cat t.cpp && cl -c t.cpp
struct A { typedef int I; };

namespace N {
template <class T> struct B { typedef typename T::I I; };
template <class T> typename B<T>::I foo (T) { return 0; }

template N::B<A>::I N::foo (A);
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 14.00.50727.42 
for 80x86
Copyright (C) Microsoft Corporation. All rights reserved.

t.cpp(8) : error C2785: 'B<T>::I N::foo(T)' and 'int N::foo(A)' have 
different return types
t.cpp(5) : see declaration of 'N::foo'
t.cpp(8) : see declaration of 'N::foo'
t.cpp(8) : warning C4667: 'int N::foo(A)' : no function template defined 
that matches forced instantiation

You might be able to track it here:


View raw message