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

[cling][c++20] Interpreter crash on concept definition #12779

Closed
jalopezg-git opened this issue May 6, 2023 · 0 comments · Fixed by #12781
Closed

[cling][c++20] Interpreter crash on concept definition #12779

jalopezg-git opened this issue May 6, 2023 · 0 comments · Fixed by #12781

Comments

@jalopezg-git
Copy link
Contributor

jalopezg-git commented May 6, 2023

Describe the bug

An interactive ROOT session crashes on definition of a simple C++20 concept, e.g.

template <typename T> concept Hashable = requires(T a) {
   { std::hash<T>{}(a) } -> std::convertible_to<std::size_t>;
};

For reference, the relevant stack trace frames is provided below.

#5  0x00007f388ee59180 in cling::isDefinition(clang::Decl const*) () from /home/jalopezg/CERN/root/_build.cxx20/lib/libCling.so
#6  0x00007f388ee59c60 in cling::DefinitionShadower::invalidatePreviousDefinitions(clang::NamedDecl*) const () from /home/jalopezg/CERN/root/_build.cxx20/lib/libCling.so
#7  0x00007f388ee5b37b in cling::DefinitionShadower::Transform(clang::Decl*) () from /home/jalopezg/CERN/root/_build.cxx20/lib/libCling.so
#8  0x00007f388ee509c2 in cling::DeclCollector::TransformDecl(clang::Decl*) const () from /home/jalopezg/CERN/root/_build.cxx20/lib/libCling.so
#9  0x00007f388ee50b75 in cling::DeclCollector::Transform(clang::DeclGroupRef&) () from /home/jalopezg/CERN/root/_build.cxx20/lib/libCling.so
#10 0x00007f388ee50d41 in cling::DeclCollector::HandleTopLevelDecl(clang::DeclGroupRef) () from /home/jalopezg/CERN/root/_build.cxx20/lib/libCling.so
#11 0x00007f388ee11089 in cling::IncrementalParser::ParseInternal(llvm::StringRef) () from /home/jalopezg/CERN/root/_build.cxx20/lib/libCling.so
#12 0x00007f388ee118ac in cling::IncrementalParser::Compile(llvm::StringRef, cling::CompilationOptions const&) () from /home/jalopezg/CERN/root/_build.cxx20/lib/libCling.so
#13 0x00007f388ed6e87c in cling::Interpreter::DeclareInternal(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, cling::CompilationOptions const&, cling::Transaction**) const () from /home/jalopezg/CERN/root/_build.cxx20/lib/libCling.so
#14 0x00007f388ed71e7e in cling::Interpreter::process(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, cling::Value*, cling::Transaction**, bool) () from /home/jalopezg/CERN/root/_build.cxx20/lib/libCling.so
#15 0x00007f388ee6443f in cling::MetaProcessor::process(llvm::StringRef, cling::Interpreter::CompilationResult&, cling::Value*, bool) () from /home/jalopezg/CERN/root/_build.cxx20/lib/libCling.so
#16 0x00007f388ec6fd0c in HandleInterpreterException(cling::MetaProcessor*, char const*, cling::Interpreter::CompilationResult&, cling::Value*) () from /home/jalopezg/CERN/root/_build.cxx20/lib/libCling.so

Setup

  1. ROOT version: master
  2. Operating system: ArchLinux x86_64
@jalopezg-git jalopezg-git self-assigned this May 6, 2023
@jalopezg-git jalopezg-git added this to the 6.28/04 milestone May 6, 2023
@jalopezg-git jalopezg-git changed the title [cling] Interpreter crash on C++20 concept definition [cling][c++20] Interpreter crash on concept definition May 6, 2023
jalopezg-git added a commit to jalopezg-git/root that referenced this issue May 7, 2023
In principle, for a TemplateDecl, `isDefinition()` issues a recursive
call passing the templated decl as a parameter.  A `ConceptDecl` is
derived from `TemplateDecl`, however, it should always be considered
a definition.

Also, update the DeclShadowing test incorporating a C++20 concept.

Fixes root-project#12779.
jalopezg-git added a commit to jalopezg-git/root that referenced this issue May 7, 2023
In principle, for a TemplateDecl, `isDefinition()` issues a recursive
call passing the templated decl as a parameter.  A `ConceptDecl` is
derived from `TemplateDecl`, however, it should always be considered
a definition.

Also, update the DeclShadowing test incorporating a C++20 concept.

Fixes root-project#12779.
Axel-Naumann pushed a commit that referenced this issue May 7, 2023
In principle, for a TemplateDecl, `isDefinition()` issues a recursive
call passing the templated decl as a parameter.  A `ConceptDecl` is
derived from `TemplateDecl`, however, it should always be considered
a definition.

Also, update the DeclShadowing test incorporating a C++20 concept.

Fixes #12779.
Axel-Naumann pushed a commit that referenced this issue May 7, 2023
In principle, for a TemplateDecl, `isDefinition()` issues a recursive
call passing the templated decl as a parameter.  A `ConceptDecl` is
derived from `TemplateDecl`, however, it should always be considered
a definition.

Also, update the DeclShadowing test incorporating a C++20 concept.

Fixes #12779.
enirolf pushed a commit to enirolf/root that referenced this issue May 26, 2023
In principle, for a TemplateDecl, `isDefinition()` issues a recursive
call passing the templated decl as a parameter.  A `ConceptDecl` is
derived from `TemplateDecl`, however, it should always be considered
a definition.

Also, update the DeclShadowing test incorporating a C++20 concept.

Fixes root-project#12779.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant