[llvm-bugs] [Bug 38089] New: Crash on templates and using declaration, expected TemplateDecl, found UnresolvedUsingValueDecl

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jul 6 21:47:23 PDT 2018


https://bugs.llvm.org/show_bug.cgi?id=38089

            Bug ID: 38089
           Summary: Crash on templates and using declaration, expected
                    TemplateDecl, found UnresolvedUsingValueDecl
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: rtrieu at google.com
                CC: llvm-bugs at lists.llvm.org

test.cpp:
template <typename T>
struct C {
  template<typename U>
  void Get() {}
};

template <typename T>
class A {
  using C<T>::Get;
  void Run() { Get<int>(); }
};

Compiler invocation:
clang test.cpp:

clang/lib/Sema/SemaDecl.cpp
1064        TemplateDecl *TD
1065          = cast<TemplateDecl>((*Result.begin())->getUnderlyingDecl());
1066        IsFunctionTemplate = isa<FunctionTemplateDecl>(TD);
1067        IsVarTemplate = isa<VarTemplateDecl>(TD);

On line 1065, the underlying Decl was expected to be a TemplateDecl.  With the
code provided above, the actual Decl returned was a UnresolvedUsingValueDecl,
leading to an assertion failure inside the cast call.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180707/7204a554/attachment.html>


More information about the llvm-bugs mailing list