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

PyROOT cannot handle SFINAE functions with variadic template arguments #14016

Open
1 task done
taehyounpark opened this issue Nov 3, 2023 · 4 comments
Open
1 task done

Comments

@taehyounpark
Copy link
Contributor

taehyounpark commented Nov 3, 2023

Check duplicate issues.

  • Checked for duplicates

Description

Following from wlav/cppyy#201, it seems there is an issue with (ROOT's) cppyy's handling of SFINAE functions with variadic template arguments.

Reproducer

import ROOT
import cppyy

cppyy.cppdef('''
template <typename T> struct TestSfinae {
  template <typename U, typename V = T,
            std::enable_if_t<std::is_arithmetic_v<V>, bool> = false>
  auto test_single(U arg) {
    std::cout << "good" << std::endl;
    return 0;
  }
  template <typename... Args, typename V = T,
            std::enable_if_t<std::is_arithmetic_v<V>, bool> = false>
  auto test_pack(Args... args) {
    std::cout << "good" << std::endl;
    return 0;
  }
};
''')

# call from cling
cppyy.cppdef('''auto testing = TestSfinae<float>();''')
cppyy.cppdef('''auto single_call = testing.test_single(1);''')  # good
cppyy.cppdef('''auto pack_call = testing.test_pack(1,2,3);''')  # good

# call from bindings
testing = cppyy.gbl.TestSfinae['float']()
testing.test_single(1)  # good
testing.test_pack(1,2,3)  # fails

ROOT version

 ------------------------------------------------------------------
| Welcome to ROOT 6.28/06                        https://root.cern |
| (c) 1995-2023, The ROOT Team; conception: R. Brun, F. Rademakers |
| Built for macosx64 on Sep 17 2023, 12:38:14                      |
| From heads/latest-stable@7745d36d                                |
| With Apple clang version 14.0.3 (clang-1403.0.22.14.1)           |
| Try '.help'/'.?', '.demo', '.license', '.credits', '.quit'/'.q'  |
 ------------------------------------------------------------------

Installation method

build from source

Operating system

MacOS

Additional context

input_line_24:6:70: error: no matching member function for call to 'test_pack'
      new (ret) (int) (((TestSfinae<float>*)obj)->TestSfinae<float>::test_pack<int, int, int, float, false>(*(int*)args[0], *(int*)args[1],
                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
input_line_18:11:8: note: candidate template ignored: invalid explicitly-specified argument for template parameter 'Args'
  auto test_pack(Args... args) {
       ^
@taehyounpark
Copy link
Contributor Author

Hi, I just wanted to check back on this. Thank you in advance!

@taehyounpark
Copy link
Contributor Author

@vepadulano Hi Vincenzo, sorry to bother you if this is already on your radar, but I was wondering if I could receive some help with this? Thank you in advance.

@dpiparo
Copy link
Member

dpiparo commented Jul 26, 2024

tested with ROOT master (llvm16 and the new cppyy), still reproducible.

@taehyounpark
Copy link
Contributor Author

Hi @dpiparo,

Thanks for taking a look. This could be related to #15062, in which case there is some discussion about the underlying issue.

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

4 participants