Skip to content

Is this expected to work? Attempt at minimal reproducer #18

@jjwilke

Description

@jjwilke

I know there are limitations currently. The code:

#include <string>
#include <iostream>

std::string name;

template <int x>
[[clang::jit]] void run(const char* str){
  name = std::string(str);
  std::cout << name << std::endl;
}

int main(int argc, char** argv)
{
  run<0>("hi there");
  return 0;
}

yields the following error:

include/c++/v1/string:2314:5: error: no
      matching member function for call to '__move_assign'
    __move_assign(__str, integral_constant<bool,
    ^~~~~~~~~~~~~
build/break.cc:8:8: note: in
      instantiation of member function 'std::__1::basic_string<char,
      std::__1::char_traits<char>, std::__1::allocator<char> >::operator=' requested here
  name = std::string(str);
       ^
build/break.cc:14:3: note: in
      instantiation of function template specialization 'run<0>' requested here
  run<0>("hi there");  
  ^
clang-jit/build/break.cc:14:3: note: in
      instantiation of function template specialization 'run<0>' requested here
include/c++/v1/string:1615:10: note: 
      candidate function not viable: no known conversion from 'integral_constant<[...],
      __alloc_traits::propagate_on_container_move_assignment::value aka true>' to
      'integral_constant<[...], (false) aka false>' for 2nd argument
    void __move_assign(basic_string& __str, false_type)
         ^
include/c++/v1/string:1618:10: note: 
      candidate function not viable: no known conversion from 'integral_constant<...>' to
      'integral_constant<...>' for 2nd argument
    void __move_assign(basic_string& __str, true_type)
         ^
LLVM ERROR: Clang JIT failed!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions