[LLVMbugs] [Bug 24175] New: Assertion with typo correction with invalid lambda and template instantiation

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Jul 17 19:18:29 PDT 2015


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

            Bug ID: 24175
           Summary: Assertion with typo correction with invalid lambda and
                    template instantiation
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: rtrieu at google.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Typo correction is not marking some types as invalid causing Clang to assert
when trying to take the size of an invalid type during template instantiation.

clang -fsyntax-only -std=c++11 run.cpp 
run.cpp:32:23: error: call to deleted constructor of 'DeletedCopy'
  auto some_lambda = [DC]() {};
                      ^~
run.cpp:27:3: note: 'DeletedCopy' has been explicitly marked deleted here
  DeletedCopy(const DeletedCopy&) = delete;
  ^
run.cpp:33:27: error: use of undeclared identifier 'some_lambda2'; did you mean
      'some_lambda'?
  Wrapper<void()> A = Run(some_lambda2);
                          ^~~~~~~~~~~~
                          some_lambda
run.cpp:32:8: note: 'some_lambda' declared here
  auto some_lambda = [DC]() {};
       ^

clang-3.5: ../tools/clang/lib/AST/ASTContext.cpp:1733: clang::TypeInfo
clang::ASTContext::getTypeInfoImpl(const clang::Type *) const: Assertion
`!A->getDeducedType().isNull() && "cannot request the size of an undeduced or
dependent auto type"' failed.

1.    <eof> parser at end of file
2.    run.cpp:9:3: instantiating function definition 'operator Wrapper'
clang-3.5: error: unable to execute command: Aborted (core dumped)
clang-3.5: error: clang frontend command failed due to signal (use -v to see
invocation)

run.cpp:
template <typename F>
struct Wrapper {};

template <typename Impl>
struct Outer {
  explicit Outer(const Impl& impl) {}

  template <typename F>
  operator Wrapper<F>() const {
    return new Inner<F>(impl_);
  }

  template <typename F>
  struct Inner : public Wrapper<F> {
    explicit Inner(const Impl& impl) {}
    Impl impl_;
  };

  Impl impl_;
};

template <typename FunctionImpl>
Outer<FunctionImpl> Run(FunctionImpl) {}

struct DeletedCopy {
  DeletedCopy();
  DeletedCopy(const DeletedCopy&) = delete;
};

void Test() {
  DeletedCopy DC;
  auto some_lambda = [DC]() {};
  Wrapper<void()> A = Run(some_lambda2);
}

-- 
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/20150718/41df526f/attachment.html>


More information about the llvm-bugs mailing list