C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Incorrect compiler diagnostic in VC++.NET 2005? (WAS: VC++.N

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ Language (Moderated)
View previous topic :: View next topic  
Author Message
Dilip
Guest





PostPosted: Sun Sep 26, 2004 10:00 am    Post subject: Incorrect compiler diagnostic in VC++.NET 2005? (WAS: VC++.N Reply with quote



Vaclav

I have taken the liberty to cross-post this
microsoft.public.dotnet.languages.vc which has more visibility from
MSFT VC++ team.

thanks
--Dilip

Actual post by Vaclav Haisman originally posted at
comp.lang.c++.moderated follows:

==========================================================================

I have this test case that VC++.NET 2005 beta refuses to compile. I
think
that it is valid C++. If it is, is there a "bugzilla" for the compiler
where
I could report it?

VH

#include <string>
#include <iterator>


template <typename T>
struct default_index_policy
{
typedef T index_type;

template <typename U>
index_type
minus_left (index_type const & t, U const & u) const
{
return t - u;
}
};

/////////////////////////////////////////////////////////////////

typedef size_t _default_index_type;

template <typename Iterator, typename Index = _default_index_type,
typename IndexPolicy = default_index_policy
class indexing_iterator
{
public:
typedef Iterator iterator_type;
typedef Index index_type;
typedef IndexPolicy index_policy_type;

class IndexProxy
{
protected:
index_type const idx;
index_policy_type const idx_policy;

public:
IndexProxy (index_type const & i, index_policy_type const &
pol)
: idx (i), idx_policy (pol)
{ }

index_type index () const
{
return idx;
}

operator index_type () const
{
return idx;
}

// IndexProxy operators:
template <typename U>
friend IndexProxy
operator - (IndexProxy const & p, U const & u)
{
return IndexProxy (p.idx_policy.minus_left (p.index (),
u),
p.idx_policy);
}
};

typedef IndexProxy index_proxy_type;

protected:
iterator_type current;
index_type idx;
index_policy_type idx_policy;

public:
indexing_iterator ()
{ }

index_proxy_type
index () const
{
return IndexProxy (idx, idx_policy);
}
};

///////////////////////////////////////////////////////////////////////////////////

int main(int argc, char* argv[])
{
indexing_iterator<std::string::const_iterator, int,
default_index_policy it;
int index = it.index () - 1;

return 0;
}


Build log:
------ Build started: Project: test, Configuration: Debug Win32 ------
Compiling...
test.cpp
d:WilXVS.NETtesttesttest.cpp(57) : error C3861: 'IndexProxy':
identifier not found
d:WilXVS.NETtesttesttest.cpp(84) : see reference to
function
template instantiation
'indexing_iterator<Iterator,Index,IndexPolicy>::IndexProxy
operator -<int>(const
indexing_iterator<Iterator,Index,IndexPolicy>::IndexProxy &,const U
&)'
being compiled
with
[
Iterator=std::_String_const_iterator<char,std::char_traits,
Index=int,
IndexPolicy=default_index_policy<int>,
U=int
]
Build log was saved at
"file://d:WilXVS.NETtesttestDebugBuildLog.htm"
test - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped
==========

==========================================================================

[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ Language (Moderated) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.