[llvm-bugs] [Bug 24781] New: Crash in typo correct with bad type suggestion.

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Sep 10 16:37:42 PDT 2015


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

            Bug ID: 24781
           Summary: Crash in typo correct with bad type suggestion.
           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: llvm-bugs at lists.llvm.org, rikka at google.com
    Classification: Unclassified

repro.cpp:
namespace A {
namespace B {

class Foo {};

}  // namespace B
}  // namespace A

namespace C {
namespace D {

//Uncomment using statement to prevent crash.
//using A::B::Foo;

class Bar : public A::B::Foo {};

}  // namespace D
}  // namespace C

using C::D::Foo;

Command:
clang repro.cpp

Output:
repro.cpp:20:7: error: no member named 'Foo' in namespace 'C::D'; did you mean
      'C::D::Bar::Foo'?
using C::D::Foo;
      ^~~~~~~~~
      C::D::Bar::Foo
repro.cpp:4:7: note: 'C::D::Bar::Foo' declared here
class Foo {};
      ^
clang-3.5: ../include/llvm/Support/Casting.h:237: typename cast_retty<X, Y
*>::ret_type llvm::cast(Y *) [X = clang::CXXRecordDecl, Y =
clang::DeclContext]: Assertion `isa<X>(Val) && "cast<Ty>() argument of
incompatible type!"' failed.
#0 0x16cb20d llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/local/bin/clang-3.5+0x16cb20d)
#1 0x16ca8a6 llvm::sys::RunSignalHandlers()
(/usr/local/bin/clang-3.5+0x16ca8a6)
#2 0x16cc6aa SignalHandler(int) (/usr/local/bin/clang-3.5+0x16cc6aa)
#3 0x7f977e187340 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x10340)
#4 0x7f977d6b3cc9 gsignal
/build/buildd/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#5 0x7f977d6b70d8 abort /build/buildd/eglibc-2.19/stdlib/abort.c:91:0
#6 0x7f977d6acb86 __assert_fail_base
/build/buildd/eglibc-2.19/assert/assert.c:92:0
#7 0x7f977d6acc32 (/lib/x86_64-linux-gnu/libc.so.6+0x2fc32)
#8 0x23c5c20
clang::Sema::CheckInheritingConstructorUsingDecl(clang::UsingDecl*)
(/usr/local/bin/clang-3.5+0x23c5c20)
#9 0x23c2c0b clang::Sema::BuildUsingDeclaration(clang::Scope*,
clang::AccessSpecifier, clang::SourceLocation, clang::CXXScopeSpec&,
clang::DeclarationNameInfo, clang::AttributeList*, bool, bool,
clang::SourceLocation) (/usr/local/bin/clang-3.5+0x23c2c0b)
#10 0x23c1856 clang::Sema::ActOnUsingDeclaration(clang::Scope*,
clang::AccessSpecifier, bool, clang::SourceLocation, clang::CXXScopeSpec&,
clang::UnqualifiedId&, clang::AttributeList*, bool, clang::SourceLocation)
(/usr/local/bin/clang-3.5+0x23c1856)

The suggestion is wrong since a base class cannot be used in using statement.

-- 
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/20150910/805dc678/attachment-0001.html>


More information about the llvm-bugs mailing list