Skip to content

Inlet: fix issue created by last PR related to get<>() in container and proxy#1899

Merged
white238 merged 1 commit into
developfrom
bugfix/white238/inlet_compiler_bug
Jun 30, 2026
Merged

Inlet: fix issue created by last PR related to get<>() in container and proxy#1899
white238 merged 1 commit into
developfrom
bugfix/white238/inlet_compiler_bug

Conversation

@white238

Copy link
Copy Markdown
Member

Found by @chapman39

In file included from /usr/WS2/meemee/smith/repo/src/smith/physics/materials/solid_material_input.cpp:7:
  In file included from /usr/WS2/meemee/smith/repo/src/smith/infrastructure/../../smith/physics/materials/solid_material_input.hpp:18:
  In file included from /usr/WS2/meemee/smith/repo/src/smith/infrastructure/../../smith/infrastructure/input.hpp:24:
  In file included from /usr/WS2/meemee/smith/smith_tpls/toss_4_x86_64_ib/2026-06-29/llvm-19.1.3/axom-0.14.0.2-webdmbomwunrvalslv653nhs5qn4ftiy/include/axom/
  inlet.hpp:15:
  In file included from /usr/WS2/meemee/smith/smith_tpls/toss_4_x86_64_ib/2026-06-29/llvm-19.1.3/axom-0.14.0.2-webdmbomwunrvalslv653nhs5qn4ftiy/include/axom/inlet/
  Inlet.hpp:26:
  /usr/WS2/meemee/smith/smith_tpls/toss_4_x86_64_ib/2026-06-29/llvm-19.1.3/axom-0.14.0.2-webdmbomwunrvalslv653nhs5qn4ftiy/include/axom/inlet/Proxy.hpp:158:25: error: no
  matching member function for call to 'get'
    158 |     return m_container->get<T>();
        |            ~~~~~~~~~~~~~^~~~~~
  /usr/WS2/meemee/smith/repo/src/smith/physics/materials/solid_material_input.cpp:68:58: note: in instantiation of function template specialization
  'axom::inlet::Proxy::get<std::variant<smith::solid_mechanics::LinearHardening, smith::solid_mechanics::PowerLawHardening, smith::solid_mechanics::VoceHardening>>'
  requested here
     68 |     smith::var_hardening_t hardening = base["hardening"].get<smith::var_hardening_t>();
        |                                                          ^

@white238

Copy link
Copy Markdown
Member Author

@chapman39 reported this fixed the issue.

Comment thread src/axom/inlet/Proxy.hpp
Comment on lines +159 to 200
/*!
*******************************************************************************
* \brief Returns a user-defined type from the proxy
*
* \tparam T The type of the object to retrieve
* \return The retrieved object
* \pre The Proxy must refer to a container object
*******************************************************************************
*/
template <typename T>
typename std::enable_if<!detail::is_inlet_primitive<T>::value && !detail::is_std_function<T>::value &&
detail::has_ProxyFromInlet_specialization<T>::value,
T>::type
get() const
{
SLIC_ASSERT_MSG(m_container != nullptr,
"[Inlet] Tried to read a user-defined type from a Proxy "
"containing a single field or function");
FromInlet<T> from_inlet;
return from_inlet(*this);
}

/*!
*******************************************************************************
* \brief Returns a user-defined type from the proxy
*
* \tparam T The type of the object to retrieve
* \return The retrieved object
* \pre The Proxy must refer to a container object
*******************************************************************************
*/
template <typename T>
typename std::enable_if<!detail::is_inlet_primitive<T>::value && !detail::is_std_function<T>::value, T>::type
typename std::enable_if<!detail::is_inlet_primitive<T>::value && !detail::is_std_function<T>::value &&
!detail::has_ProxyFromInlet_specialization<T>::value,
T>::type
get() const
{
SLIC_ASSERT_MSG(m_container != nullptr,
"[Inlet] Tried to read a user-defined type from a Proxy "
"containing a single field or function");
return m_container->get<T>();
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Modernization opportunity (not required for this PR):
This should be easy to express as an if constexpr (and soon, concepts) instead of SFINAE.

Looks like there are several similar opportunities throughout inlet.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes Inlet originally wanted to use concepts due to the complexity of SFINAE but could not. I will do that in a targeted PR eventually.


TYPED_TEST(inlet_object, variant_struct_by_value)
{
std::string testString = "shape = { kind = \"box\"; width = 3.0; height = 4.0 }";

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor (not required):
This would be somewhat easier to read/maintain as a raw string literal.

@white238 white238 merged commit 5cc127d into develop Jun 30, 2026
15 checks passed
@white238 white238 deleted the bugfix/white238/inlet_compiler_bug branch June 30, 2026 18:36
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.

4 participants