Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gcc considers some Call memfn ambiguous #17

Closed
wants to merge 1 commit into from

Conversation

daedric
Copy link
Contributor

@daedric daedric commented May 8, 2017

No description provided.

@jfirebaugh
Copy link
Contributor

jfirebaugh commented May 8, 2017

What's the error you're getting for this, what code triggers it, and what GCC version are you using? With GCC 5.4.1, I get a linker error ("symbol `_ZL6method' is already defined") compiling the tests, which I guess is not related.

@daedric
Copy link
Contributor Author

daedric commented May 8, 2017

I tested with gcc 5 and 6 with my current master it works, with mapbox's I've those errors:

/Users/daedric/work/perso/jni.hpp/examples/hello.cpp: In lambda function:
/Users/daedric/work/perso/jni.hpp/examples/hello.cpp:57:105: error: call of overloaded 'Call(JNIEnv&, jni::Method<RegisterHighLevel(JavaVM*)::PrintStream, void(jni::Object<jni::StringTag>)>&, jni::Object<jni::StringTag>)' is ambiguous
                 u"Hello, " + jni::Make<std::u16string>(env, args.Get(env, 0)) + u" (Native High-Level)"));
                                                                                                         ^
In file included from /Users/daedric/work/perso/jni.hpp/include/jni/jni.hpp:13:0,
                 from /Users/daedric/work/perso/jni.hpp/examples/hello.cpp:1:
/Users/daedric/work/perso/jni.hpp/include/jni/object.hpp:108:18: note: candidate: std::enable_if_t<(! jni::IsPrimitive<T>::value), T> jni::Object<TheTag>::Call(JNIEnv&, const jni::Method<TheTag, R(Args ...)>&, const Args& ...) const [with R = void; Args = {jni::Object<jni::StringTag>}; TheTag = RegisterHighLevel(JavaVM*)::PrintStream; std::enable_if_t<(! jni::IsPrimitive<T>::value), T> = void; JNIEnv = JNIEnv_]
             auto Call(JNIEnv& env, const Method<TagType, R (Args...)>& method, const Args&... args) const
                  ^~~~
/Users/daedric/work/perso/jni.hpp/include/jni/object.hpp:115:18: note: candidate: void jni::Object<TheTag>::Call(JNIEnv&, const jni::Method<TheTag, void(Args ...)>&, const Args& ...) const [[ 57%] Built target hello_jar
with Args = {jni::Object<jni::StringTag>}; TheTag = RegisterHighLevel(JavaVM*)::PrintStream; JNIEnv = JNIEnv_]
             void Call(JNIEnv& env, const Method<TagType, void (Args...)>& method, const Args&... args) const
                  ^~~~
/Users/daedric/work/perso/jni.hpp/test/high_level.cpp: In function 'int main()':
/Users/daedric/work/perso/jni.hpp/test/high_level.cpp:409:63: error: call of overloaded 'Call(TestEnv&, jni::StaticMethod<{anonymous}::Test, void(unsigned char)>&, const jboolean&)' is ambiguous
     testClass.Call(env, voidBooleanStaticMethod, jni::jni_true);
                                                               ^
In file included from /Users/daedric/work/perso/jni.hpp/include/jni/jni.hpp:12:0,
                 from /Users/daedric/work/perso/jni.hpp/test/high_level.cpp:3:
/Users/daedric/work/perso/jni.hpp/include/jni/class.hpp:92:18: note: candidate: std::enable_if_t<(! jni::IsPrimitive<T>::value), T> jni::Class<TheTag>::Call(JNIEnv&, const jni::StaticMethod<TheTag, R(Args ...)>&, const Args& ...) const [with R = void; Args = {unsigned char}; TheTag = {anonymous}::Test; std::enable_if_t<(! jni::IsPrimitive<T>::value), T> = void; JNIEnv = _JNIEnv]
             auto Call(JNIEnv& env, const StaticMethod<TagType, R (Args...)>& method, const Args&... args) const
                  ^~~~
/Users/daedric/work/perso/jni.hpp/include/jni/class.hpp:99:18: note: candidate: void jni::Class<TheTag>::Call(JNIEnv&, const jni::StaticMethod<TheTag, void(Args ...)>&, const Args& ...) const [with Args = {unsigned char}; TheTag = {anonymous}::Test; JNIEnv = _JNIEnv]
             void Call(JNIEnv& env, const StaticMethod<TagType, void (Args...)>& method, const Args&... args) const
                  ^~~~
/Users/daedric/work/perso/jni.hpp/test/high_level.cpp:410:55: error: call of overloaded 'Call(TestEnv&, jni::StaticMethod<{anonymous}::Test, void(jni::Object<{anonymous}::Test>)>&, jni::Object<{anonymous}::Test>&)' is ambiguous
     testClass.Call(env, voidObjectStaticMethod, object);
                                                       ^
In file included from /Users/daedric/work/perso/jni.hpp/include/jni/jni.hpp:12:0,
                 from /Users/daedric/work/perso/jni.hpp/test/high_level.cpp:3:
/Users/daedric/work/perso/jni.hpp/include/jni/class.hpp:92:18: note: candidate: std::enable_if_t<(! jni::IsPrimitive<T>::value), T> jni::Class<TheTag>::Call(JNIEnv&, const jni::StaticMethod<TheTag, R(Args ...)>&, const Args& ...) const [with R = void; Args = {jni::Object<{anonymous}::Test>}; TheTag = {anonymous}::Test; std::enable_if_t<(! jni::IsPrimitive<T>::value), T> = void; JNIEnv = _JNIEnv]
             auto Call(JNIEnv& env, const StaticMethod<TagType, R (Args...)>& method, const Args&... args) const
                  ^~~~
/Users/daedric/work/perso/jni.hpp/include/jni/class.hpp:99:18: note: candidate: void jni::Class<TheTag>::Call(JNIEnv&, const jni::StaticMethod<TheTag, void(Args ...)>&, const Args& ...) const [with Args = {jni::Object<{anonymous}::Test>}; TheTag = {anonymous}::Test; JNIEnv = _JNIEnv]
             void Call(JNIEnv& env, const StaticMethod<TagType, void (Args...)>& method, const Args&... args) const
                  ^~~~
/Users/daedric/work/perso/jni.hpp/test/high_level.cpp:509:54: error: call of overloaded 'Call(TestEnv&, jni::Method<{anonymous}::Test, void(unsigned char)>&, const jboolean&)' is ambiguous
     object.Call(env, voidBooleanMethod, jni::jni_true);
                                                      ^
In file included from /Users/daedric/work/perso/jni.hpp/include/jni/jni.hpp:13:0,
                 from /Users/daedric/work/perso/jni.hpp/test/high_level.cpp:3:
/Users/daedric/work/perso/jni.hpp/include/jni/object.hpp:108:18: note: candidate: std::enable_if_t<(! jni::IsPrimitive<T>::value), T> jni::Object<TheTag>::Call(JNIEnv&, const jni::Method<TheTag, R(Args ...)>&, const Args& ...) const [with R = void; Args = {unsigned char}; TheTag = {anonymous}::Test; std::enable_if_t<(! jni::IsPrimitive<T>::value), T> = void; JNIEnv = _JNIEnv]
             auto Call(JNIEnv& env, const Method<TagType, R (Args...)>& method, const Args&... args) const
                  ^~~~
/Users/daedric/work/perso/jni.hpp/include/jni/object.hpp:115:18: note: candidate: void jni::Object<TheTag>::Call(JNIEnv&, const jni::Method<TheTag, void(Args ...)>&, const Args& ...) const [with Args = {unsigned char}; TheTag = {anonymous}::Test; JNIEnv = _JNIEnv]
             void Call(JNIEnv& env, const Method<TagType, void (Args...)>& method, const Args&... args) const
                  ^~~~
/Users/daedric/work/perso/jni.hpp/test/high_level.cpp:510:46: error: call of overloaded 'Call(TestEnv&, jni::Method<{anonymous}::Test, void(jni::Object<{anonymous}::Test>)>&, jni::Object<{anonymous}::Test>&)' is ambiguous
     object.Call(env, voidObjectMethod, object);
                                              ^
In file included from /Users/daedric/work/perso/jni.hpp/include/jni/jni.hpp:13:0,
                 from /Users/daedric/work/perso/jni.hpp/test/high_level.cpp:3:
/Users/daedric/work/perso/jni.hpp/include/jni/object.hpp:108:18: note: candidate: std::enable_if_t<(! jni::IsPrimitive<T>::value), T> jni::Object<TheTag>::Call(JNIEnv&, const jni::Method<TheTag, R(Args ...)>&, const Args& ...) const [with R = void; Args = {jni::Object<{anonymous}::Test>}; TheTag = {anonymous}::Test; std::enable_if_t<(! jni::IsPrimitive<T>::value), T> = void; JNIEnv = _JNIEnv]
             auto Call(JNIEnv& env, const Method<TagType, R (Args...)>& method, const Args&... args) const
                  ^~~~
/Users/daedric/work/perso/jni.hpp/include/jni/object.hpp:115:18: note: candidate: void jni::Object<TheTag>::Call(JNIEnv&, const jni::Method<TheTag, void(Args ...)>&, const Args& ...) const [with Args = {jni::Object<{anonymous}::Test>}; TheTag = {anonymous}::Test; JNIEnv = _JNIEnv]
             void Call(JNIEnv& env, const Method<TagType, void (Args...)>& method, const Args&... args) const
                  ^~~~

@jfirebaugh
Copy link
Contributor

Thanks. Reduced testcase: https://godbolt.org/g/9PqHZh

I tried to submit a GCC bug, but their bugtracker is closed to new account creation. ☹️

@jfirebaugh
Copy link
Contributor

Applied in 69a84f7. Thanks again!

@jfirebaugh jfirebaugh closed this May 8, 2017
@daedric
Copy link
Contributor Author

daedric commented May 8, 2017

I've an account there, I'll submit one and link the issue :)

@daedric
Copy link
Contributor Author

daedric commented May 8, 2017

@daedric daedric deleted the gcc-ambiguous-call branch March 26, 2024 11:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants