Topic: nullptr and overloading
Author: Magnus F <magfr@lysator.liu.se>
Date: Sun, 14 Feb 2010 09:55:10 CST Raw View
Hello.
I am a little confused, looking at the following code I cant see how
the standard disambiguates it:
void f(bool);
void f(char*);
void t()
{
f(nullptr);
}
Now, 4.1 do not apply (nullptr is already an rvalue)
4.10 and 4.12 do apply so both f are viable candidates.
13.3.3.3.2 4 do not apply as that is only relevant for pointers.
So by my reading this is ambiguos, is that intended?
[note to moderator: google's web interface sent a draft version of
this, could you please stop it]
--
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@netlab.cs.rpi.edu]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html ]
Author: =?ISO-8859-1?Q?Daniel_Kr=FCgler?= <daniel.kruegler@googlemail.com>
Date: Sun, 14 Feb 2010 22:56:22 CST Raw View
On 14 Feb., 16:55, Magnus F <ma...@lysator.liu.se> wrote:
> I am a little confused, looking at the following code I cant see how
> the standard disambiguates it:
>
> void f(bool);
> void f(char*);
>
> void t()
> {
> f(nullptr);
>
> }
>
> Now, 4.1 do not apply (nullptr is already an rvalue)
> 4.10 and 4.12 do apply so both f are viable candidates.
> 13.3.3.3.2 4 do not apply as that is only relevant for pointers.
>
> So by my reading this is ambiguos, is that intended?
See core issue
http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#961
which should solve this problem.
HTH & Greetings from Bremen,
- Daniel
--
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@netlab.cs.rpi.edu]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html ]
Author: "Johannes Schaub (litb)" <schaub-johannes@web.de>
Date: Sun, 14 Feb 2010 22:57:09 CST Raw View
Magnus F wrote:
> Hello.
>
> I am a little confused, looking at the following code I cant see how
> the standard disambiguates it:
>
> void f(bool);
> void f(char*);
>
> void t()
> {
> f(nullptr);
> }
>
> Now, 4.1 do not apply (nullptr is already an rvalue)
> 4.10 and 4.12 do apply so both f are viable candidates.
> 13.3.3.3.2 4 do not apply as that is only relevant for pointers.
>
Work is under way to change 13.3.3.3.2 4 . See
http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#961
--
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@netlab.cs.rpi.edu]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html ]