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

Build fails on i386: use of overloaded operator '[]' is ambiguous #743

Open
yurivict opened this issue Dec 7, 2021 · 5 comments
Open

Build fails on i386: use of overloaded operator '[]' is ambiguous #743

yurivict opened this issue Dec 7, 2021 · 5 comments
Assignees
Labels

Comments

@yurivict
Copy link

yurivict commented Dec 7, 2021

/wrkdirs/usr/ports/science/axom/work/axom-0.6.1/src/axom/klee/IOUtil.cpp:40:38: error: use of overloaded operator '[]' is ambiguous (with operand types 'const inlet::Proxy' and 'const char *')
  auto values = toDoubleVector(parent[fieldName], expectedDims, fieldName);
                               ~~~~~~^~~~~~~~~~
/wrkdirs/usr/ports/science/axom/work/axom-0.6.1/src/axom/inlet/Proxy.hpp:123:9: note: candidate function
  Proxy operator[](const std::string& name) const;
        ^
/wrkdirs/usr/ports/science/axom/work/axom-0.6.1/src/axom/klee/IOUtil.cpp:40:38: note: built-in candidate operator[](int, const char *)
  auto values = toDoubleVector(parent[fieldName], expectedDims, fieldName);
                                     ^
/wrkdirs/usr/ports/science/axom/work/axom-0.6.1/src/axom/klee/IOUtil.cpp:40:38: note: built-in candidate operator[](int, const volatile char *)
/wrkdirs/usr/ports/science/axom/work/axom-0.6.1/src/axom/klee/IOUtil.cpp:52:12: error: no matching function for call to 'toArrayLike'
    return toArrayLike<T>(parent, fieldName, expectedDims);
           ^~~~~~~~~~~~~~
/wrkdirs/usr/ports/science/axom/work/axom-0.6.1/src/axom/klee/IOUtil.cpp:69:10: note: in instantiation of function template specialization 'axom::klee::internal::toArrayLike<axom::primal::Point<double, 3> >' requested here
  return toArrayLike(parent, fieldName, expectedDims, defaultValue);
         ^
/wrkdirs/usr/ports/science/axom/work/axom-0.6.1/src/axom/klee/IOUtil.cpp:36:3: note: candidate template ignored: substitution failure [with T = axom::primal::Point<double, 3>]
T toArrayLike(inlet::Proxy const &parent,
  ^
/wrkdirs/usr/ports/science/axom/work/axom-0.6.1/src/axom/klee/IOUtil.cpp:45:3: note: candidate function template not viable: requires 4 arguments, but 3 were provided
T toArrayLike(inlet::Proxy const &parent,
  ^
/wrkdirs/usr/ports/science/axom/work/axom-0.6.1/src/axom/klee/IOUtil.cpp:52:12: error: no matching function for call to 'toArrayLike'
    return toArrayLike<T>(parent, fieldName, expectedDims);
           ^~~~~~~~~~~~~~
/wrkdirs/usr/ports/science/axom/work/axom-0.6.1/src/axom/klee/IOUtil.cpp:84:10: note: in instantiation of function template specialization 'axom::klee::internal::toArrayLike<axom::primal::Vector<double, 3> >' requested here
  return toArrayLike(parent, fieldName, expectedDims, defaultValue);
         ^
/wrkdirs/usr/ports/science/axom/work/axom-0.6.1/src/axom/klee/IOUtil.cpp:36:3: note: candidate template ignored: substitution failure [with T = axom::primal::Vector<double, 3>]
T toArrayLike(inlet::Proxy const &parent,
  ^
/wrkdirs/usr/ports/science/axom/work/axom-0.6.1/src/axom/klee/IOUtil.cpp:45:3: note: candidate function template not viable: requires 4 arguments, but 3 were provided
T toArrayLike(inlet::Proxy const &parent,
  ^

Version: 0.6.1
OS: FreeBSD 13

@white238
Copy link
Member

white238 commented Dec 7, 2021

This seems like a compiler bug. Do you need klee functionality? If not you can turn it off with -DAXOM_ENABLE_KLEE=OFF on your CMake command.

@rhornung67
Copy link
Member

Likely. Which compiler and version are you using?

@yurivict
Copy link
Author

yurivict commented Dec 7, 2021

clang-12.0.1

@yurivict
Copy link
Author

yurivict commented Dec 7, 2021

Do you need klee functionality? If not you can turn it off with -DAXOM_ENABLE_KLEE=OFF on your CMake command.

This happens in the package build, so turning off options isn't desirable.

@publixsubfan
Copy link
Contributor

The problem appears to be coming from Inlet, specifically this overload:

template <
typename T,
typename SFINAE = typename std::enable_if<
detail::is_inlet_primitive<T>::value || detail::is_inlet_primitive_array<T>::value ||
detail::is_inlet_primitive_dict<T>::value || detail::is_std_function<T>::value ||
detail::is_primitive_std_vector<T>::value>::type>
operator T() const
{
return get<T>();
}

which seems to match with the implicitly-defined operator[](std::ptrdiff_t, const char*) on i386, apparently.

I was able to replicate the error on toss3 by adding std::is_same<T, std::ptrdiff_t>::value to the SFINAE conditional set. We can fix this by adding a operator[](const char* name) overload for the inlet::Proxy class.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants