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

Auto-pythonization of func returning tuple fails #16506

Open
1 task
Axel-Naumann opened this issue Sep 23, 2024 · 0 comments
Open
1 task

Auto-pythonization of func returning tuple fails #16506

Axel-Naumann opened this issue Sep 23, 2024 · 0 comments
Assignees

Comments

@Axel-Naumann
Copy link
Member

Check duplicate issues.

  • Checked for duplicates

Description

python3
Python 3.12.3 (main, Sep 11 2024, 14:17:37) [GCC 13.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ROOT
>>> ROOT.gInterpreter.ProcessLine('#include "tpl.cxx"')
0
>>> ROOT.fund()
input_line_40:3:14: error: no matching constructor for initialization of 'tuple<vector<int>, vector<string> >' (aka 'tuple<vector<int>,
      vector<basic_string<char> > >')
  self = new tuple<vector<int>,vector<string> >{_1, _0};
             ^                                 ~~~~~~~~
/usr/include/c++/13/tuple:1460:2: note: candidate constructor template not viable: no known conversion from 'const std::vector<string>' (aka
      'const vector<basic_string<char> >') to 'allocator_arg_t' for 1st argument
        tuple(allocator_arg_t __tag, const _Alloc& __a)
        ^     ~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/tuple:1331:2: note: candidate constructor template not viable: no known conversion from 'const vector<string,
      allocator<std::basic_string<char>>>' to 'const vector<int, allocator<int>>' for 1st argument
        tuple(const _T1& __a1, const _T2& __a2)
        ^     ~~~~~~~~~~~~~~~
/usr/include/c++/13/tuple:1338:2: note: candidate template ignored: requirement '_TupleConstraints<true, std::vector<int, std::allocator<int> >,
      std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >,
      std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >
      >::__is_explicitly_constructible()' was not satisfied [with _Dummy = true]
        tuple(const _T1& __a1, const _T2& __a2)
        ^
/usr/include/c++/13/tuple:1345:2: note: candidate template ignored: requirement '_TupleConstraints<true, std::vector<int, std::allocator<int> >,
      std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >,
      std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >
      >::__is_implicitly_constructible()' was not satisfied [with _U1 = const std::vector<string> &, _U2 = const
      std::vector<int> &]
        tuple(_U1&& __a1, _U2&& __a2)
        ^
/usr/include/c++/13/tuple:1352:2: note: candidate template ignored: requirement '_TupleConstraints<true, std::vector<int, std::allocator<int> >,
      std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >,
      std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >
      >::__is_explicitly_constructible()' was not satisfied [with _U1 = const std::vector<string> &, _U2 = const
      std::vector<int> &]
        tuple(_U1&& __a1, _U2&& __a2)
        ^
/usr/include/c++/13/tuple:1467:2: note: candidate template ignored: requirement '_TupleConstraints<true, std::vector<int, std::allocator<int> >,
      std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >,
      std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >
      >::__is_explicitly_default_constructible()' was not satisfied [with _Alloc = std::vector<int>]
        tuple(allocator_arg_t __tag, const _Alloc& __a)
        ^
/usr/include/c++/13/tuple:1356:17: note: candidate constructor not viable: requires 1 argument, but 2 were provided
      constexpr tuple(const tuple&) = default;
                ^     ~~~~~~~~~~~~
/usr/include/c++/13/tuple:1358:17: note: candidate constructor not viable: requires 1 argument, but 2 were provided
      constexpr tuple(tuple&&) = default;
                ^     ~~~~~~~
/usr/include/c++/13/tuple:1363:2: note: candidate constructor template not viable: requires single argument '__in', but 2 arguments were provided
        tuple(const tuple<_U1, _U2>& __in)
        ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/tuple:1370:2: note: candidate constructor template not viable: requires single argument '__in', but 2 arguments were provided
        tuple(const tuple<_U1, _U2>& __in)
        ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/tuple:1377:2: note: candidate constructor template not viable: requires single argument '__in', but 2 arguments were provided
        tuple(tuple<_U1, _U2>&& __in)
        ^     ~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/tuple:1384:2: note: candidate constructor template not viable: requires single argument '__in', but 2 arguments were provided
        tuple(tuple<_U1, _U2>&& __in)
        ^     ~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/tuple:1409:2: note: candidate constructor template not viable: requires single argument '__in', but 2 arguments were provided
        tuple(const pair<_U1, _U2>& __in)
        ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/tuple:1416:2: note: candidate constructor template not viable: requires single argument '__in', but 2 arguments were provided
        tuple(const pair<_U1, _U2>& __in)
        ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/tuple:1423:2: note: candidate constructor template not viable: requires single argument '__in', but 2 arguments were provided
        tuple(pair<_U1, _U2>&& __in)
        ^     ~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/tuple:1431:2: note: candidate constructor template not viable: requires single argument '__in', but 2 arguments were provided
        tuple(pair<_U1, _U2>&& __in)
        ^     ~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/tuple:1503:2: note: candidate constructor template not viable: requires 3 arguments, but 2 were provided
        tuple(allocator_arg_t __tag, const _Alloc& __a, const tuple& __in)
        ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/tuple:1508:2: note: candidate constructor template not viable: requires 3 arguments, but 2 were provided
        tuple(allocator_arg_t __tag, const _Alloc& __a, tuple&& __in)
        ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/tuple:1514:2: note: candidate constructor template not viable: requires 3 arguments, but 2 were provided
        tuple(allocator_arg_t __tag, const _Alloc& __a,
        ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/tuple:1524:2: note: candidate constructor template not viable: requires 3 arguments, but 2 were provided
        tuple(allocator_arg_t __tag, const _Alloc& __a,
        ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/tuple:1533:2: note: candidate constructor template not viable: requires 3 arguments, but 2 were provided
        tuple(allocator_arg_t __tag, const _Alloc& __a, tuple<_U1, _U2>&& __in)
        ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/tuple:1541:2: note: candidate constructor template not viable: requires 3 arguments, but 2 were provided
        tuple(allocator_arg_t __tag, const _Alloc& __a, tuple<_U1, _U2>&& __in)
        ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/tuple:1570:2: note: candidate constructor template not viable: requires 3 arguments, but 2 were provided
        tuple(allocator_arg_t __tag, const _Alloc& __a,
        ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/tuple:1578:2: note: candidate constructor template not viable: requires 3 arguments, but 2 were provided
        tuple(allocator_arg_t __tag, const _Alloc& __a,
        ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/tuple:1585:2: note: candidate constructor template not viable: requires 3 arguments, but 2 were provided
        tuple(allocator_arg_t __tag, const _Alloc& __a, pair<_U1, _U2>&& __in)
        ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/tuple:1593:2: note: candidate constructor template not viable: requires 3 arguments, but 2 were provided
        tuple(allocator_arg_t __tag, const _Alloc& __a, pair<_U1, _U2>&& __in)
        ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/tuple:1317:2: note: candidate constructor template not viable: requires 0 arguments, but 2 were provided
        tuple()
        ^
/usr/include/c++/13/tuple:1324:2: note: candidate constructor template not viable: requires 0 arguments, but 2 were provided
        tuple()
        ^
/usr/include/c++/13/tuple:1473:2: note: candidate constructor template not viable: requires 4 arguments, but 2 were provided
        tuple(allocator_arg_t __tag, const _Alloc& __a,
        ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/tuple:1481:2: note: candidate constructor template not viable: requires 4 arguments, but 2 were provided
        tuple(allocator_arg_t __tag, const _Alloc& __a,
        ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/tuple:1488:2: note: candidate constructor template not viable: requires 4 arguments, but 2 were provided
        tuple(allocator_arg_t __tag, const _Alloc& __a, _U1&& __a1, _U2&& __a2)
        ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/tuple:1496:2: note: candidate constructor template not viable: requires 4 arguments, but 2 were provided
        tuple(allocator_arg_t __tag, const _Alloc& __a,
        ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<cppyy.gbl.tuple<vector<int>,vector<string> > object at 0x71d97e0>
>>> 

Reproducer

// tpl.cxx
#include <string>
#include <tuple>
#include <vector>

std::tuple<std::vector<int>, std::vector<std::string>>
fund() {
    std::vector<int> a = {1, 2, 3};
    std::vector<std::string> b = {"a", "b", "c"};
    return std::tuple<std::vector<int>, std::vector<std::string>>(std::move(a), std::move(b));
}

ROOT version

master

Installation method

source

Operating system

Ubuntu 24.04

Additional context

No response

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

No branches or pull requests

3 participants