|
|
Home » U++ Library support » U++ Core » [GCC][C++11] error: call of overloaded 'pick(Upp::Any&)' is ambiguous
[GCC][C++11] error: call of overloaded 'pick(Upp::Any&)' is ambiguous [message #45003] |
Sat, 15 August 2015 22:35  |
Zbych
Messages: 327 Registered: July 2009
|
Senior Member |
|
|
Hi,
When I am trying to turn on c++11 and compile even simplest application:
#include <Core/Core.h>
using namespace Upp;
CONSOLE_APP_MAIN
{
}
gcc (4.8.4/ubuntu1~14.04) shows me this errors
/home/zbych/upp/uppsrc/Core/Other.h:98:70: error: call of overloaded 'pick(Upp::Any&)' is ambiguous
void operator=(Any rval_ s) { Clear(); Pick(pick(s)); }
/home/zbych/upp/uppsrc/Core/Defs.h:391:5: note: T&& Upp::pick(T&) [with T = Upp::Any]
T&& pick(T& x) { return static_cast<T&&>(x); }
/home/zbych/upp/uppsrc/Core/Defs.h:394:5: note: T&& Upp::pick(T&&) [with T = Upp::Any&]
T&& pick(T&& x) { return static_cast<T&&>(x); }
It appears that gcc doesn't know which template it should use:
template <typename T>
T&& pick(T& x) { return static_cast<T&&>(x); }
template <typename T>
T&& pick(T&& x) { return static_cast<T&&>(x); }
How can I fix this errors?
|
|
|
Re: [GCC][C++11] error: call of overloaded 'pick(Upp::Any&)' is ambiguous [message #45004 is a reply to message #45003] |
Sat, 15 August 2015 23:22   |
 |
Klugier
Messages: 1099 Registered: September 2012 Location: Poland, Kraków
|
Senior Contributor |
|
|
Hello Zbych,
For me it works fine I enable c++11 by common option in build methods. My build method settings look like this (part):
COMMON_OPTIONS = "-std=c++11";
This is my example, which test that c++11 is really enable:
#include <Core/Core.h>
using namespace Upp;
CONSOLE_APP_MAIN
{
// Simply C++11 for each loop - in C++03 compilation error
int tab[3] = {1, 2, 3};
for(int& i : tab)
Cout() << i << "\n";
}
P.S.
I have the same GCC version.
Sincerely,
Klugier
U++ - one framework to rule them all.
[Updated on: Sun, 16 August 2015 22:06] Report message to a moderator
|
|
|
Re: [GCC][C++11] error: call of overloaded 'pick(Upp::Any&)' is ambiguous [message #45006 is a reply to message #45004] |
Sun, 16 August 2015 12:16   |
Zbych
Messages: 327 Registered: July 2009
|
Senior Member |
|
|
I removed ~/.upp and ~/Upp directories and downloaded the newest version from svn (8813), but the problem persists.
It doesn't matter if I add "-std=c++11" via package organizer or setup/build methods.
I made the same test on another computer. After upgrade to svn 8813, gcc started showing the same errors.
If I remove these lines (from Defs.h):
template <typename T>
T&& pick(T&& x) { return static_cast<T&&>(x); }
gcc stops complaining.
[Updated on: Sun, 16 August 2015 12:58] Report message to a moderator
|
|
|
|
|
|
Goto Forum:
Current Time: Sat Apr 26 07:46:12 CEST 2025
Total time taken to generate the page: 0.00699 seconds
|
|
|