This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: Why does this fail to compile in C++11 mode?
- From: Jonathan Wakely <jwakely dot gcc at gmail dot com>
- To: Kenny Simpson <theonetruekenny at yahoo dot com>
- Cc: "libstdc++" <libstdc++ at gcc dot gnu dot org>
- Date: Mon, 10 Jun 2013 12:39:20 +0100
- Subject: Re: Why does this fail to compile in C++11 mode?
- References: <1370839068 dot 2396 dot YahooMailClassic at web142406 dot mail dot bf1 dot yahoo dot com>
On 10 June 2013 05:37, Kenny Simpson wrote:
> A few more data points:
>
> In c++11 mode, cstdio pulls in ::remove, but in c++98 mode, including <algorithm> doesn't pull in <cstdio>
Yes, looking at the preprocessed output I'd noticed 'using ::remove;'
but hadn't realised it wasn't present in the c++98 version.
> Changing the template instantiation to:
> template iterator_type remove<>(iterator_type, iterator_type, const X&);
>
> or
>
> template iterator_type remove<iterator_type, X>(iterator_type, iterator_type, const X&);
>
> makes it happy.
Thanks for doing the legwork, Kenny, I think you've solved it. This
reproduces the error:
namespace std
{
template<typename T, typename U>
void remove(T, U)
{ }
}
int remove(char);
namespace std
{
using ::remove;
}
namespace std
{
template void remove(int, long);
}
Reversing the order of the two remove declarations makes it compile,
so I think this is a G++ bug.