Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

Assertion failed: (Result && "declaration was not instantiated in this scope!") #3012

Closed Quuxplusone closed 14 years ago

Quuxplusone commented 14 years ago
Bugzilla Link PR5847
Status RESOLVED FIXED
Importance P normal
Reported by Daniel Dunbar (daniel@zuster.org)
Reported on 2009-12-21 13:06:26 -0800
Last modified on 2010-02-22 12:47:16 -0800
Version unspecified
Hardware PC All
CC dgregor@apple.com, llvm-bugs@lists.llvm.org, rjmccall@apple.com
Fixed by commit(s)
Attachments t.cpp (741309 bytes, text/plain)
Blocks PR5221
Blocked by
See also
Created attachment 3969
failing input

clang crashes on the attached invalid input (which comes from a gtest
minimization run).
--
ddunbar@lordcrumb:delta$ clang -c t.cpp
In file included from t.cpp:2:
/usr/include/c++/4.2.1/bits/char_traits.h:86:3275: error: no member named
'fill_n' in namespace 'std'
  ...assign(char_type* __s, std::size_t __n, char_type __a)     {       std::fill_n(__s, __n, __a);       return __s;     }   }
                                                                        ~~~~~^
/usr/include/c++/4.2.1/bits/stl_construct.h:116:1875: error: no member named
'fill' in namespace 'std'
  ...__last,         const _Tp& __x, __true_type)     { std::fill(__first, __last, __x); }     template<typename _ForwardIterator, ...
                                                        ~~~~~^
/usr/include/c++/4.2.1/bits/stl_uninitialized.h:168:606: error: no member named
'fill_n' in namespace 'std'
  ...__n,           const _Tp& __x, __true_type)     { std::fill_n(__first, __n, __x); }     template<typename _ForwardIterator, ...
                                                       ~~~~~^
/usr/include/c++/4.2.1/bits/basic_string.h:69:16407: error: no member named
'equal' in namespace 'std'
  ...{       return __x.size() == __y.size()       && std::equal(__x.begin(), __x.end(), __y.begin());     }     template<typename ...
                                                      ~~~~~^
/usr/include/c++/4.2.1/bits/basic_string.h:50:3690: error: no member named
'flush' in 'class std::basic_ostream<char, struct
      std::char_traits<char> >'
  ...inline basic_ostream<_CharT, _Traits>&     flush(basic_ostream<_CharT, _Traits>& __os)     { return __os.flush(); }   }
                                                                                                         ~~~~ ^
/usr/include/c++/4.2.1/bits/basic_string.h:50:3312: note: in instantiation of
function template specialization 'std::flush<char,
      struct std::char_traits<char> >' requested here
  ..._Traits>& __os)     { return flush(__os.put(__os.widen('\n'))); }           template<typename _CharT, typename _Traits> ...
                                  ^
/usr/include/c++/4.2.1/bits/basic_string.h:67:2214: note: in instantiation of
function template specialization 'std::endl<char, struct
      std::char_traits<char> >' requested here
  ...";   }   ~GTestCheckProvider() {     ::std::cerr << ::std::endl;     abort();   }   void FormatFileLocation(const char* file, ...
                                                         ^
/usr/include/c++/4.2.1/bits/basic_string.h:54:5228: error: no matching
constructor for initialization of '_M_stringbuf'
  ...__m = ios_base::out | ios_base::in)       : __iostream_type(), _M_stringbuf(__m)       { this->init(&_M_stringbuf); } ...
                                                                    ^~~~~~~~~~~~~~~~~
/usr/include/c++/4.2.1/bits/basic_string.h:88:154: note: in instantiation of
member function 'std::basic_stringstream<char, struct
      std::char_traits<char>, class std::allocator<char> >::basic_stringstream' requested here
  ...(*BasicNarrowIoManip)(std::ostream&);   public:        Message() : ss_(new internal::StrStream) {}     Message(const Message& ...
                                                                                ^
/usr/include/c++/4.2.1/bits/basic_string.h:55:5922: note: candidate function
  ...__endg);  }     }         extern template class basic_stringbuf<char>;    extern template class basic_istringstream<char>; ...
                                                     ^
/usr/include/c++/4.2.1/bits/basic_string.h:55:5922: note: candidate function
/usr/include/c++/4.2.1/bits/basic_string.h:54:5452: error: cannot initialize
object parameter of type 'basic_stringbuf<char>' with an
      expression of type '__stringbuf_type const' (aka 'basic_stringbuf<char, struct std::char_traits<char>, class
      std::allocator<char> > const')
  ...__string_type       str() const       { return _M_stringbuf.str(); }              void       str(const __string_type& __s) ...
                                                    ^~~~~~~~~~~~
/usr/include/c++/4.2.1/bits/basic_string.h:98:10127: note: in instantiation of
member function 'std::basic_stringstream<char, struct
      std::char_traits<char>, class std::allocator<char> >::str' requested here
  ...String StrStreamToString(StrStream* ss) {    const ::std::string& str = ss->str();   const char* const start = str.c_str(); ...
                                                                             ^
/usr/include/c++/4.2.1/bits/basic_string.h:54:825: error: no member named
'assign' in 'class std::basic_string<char, struct
      std::char_traits<char>, class std::allocator<char> >'
  ...str(const __string_type& __s)       {   _M_string.assign(__s.data(), __s.size());  _M_stringbuf_init(_M_mode);       } ...
                                             ~~~~~~~~~ ^
/usr/include/c++/4.2.1/bits/basic_string.h:54:5465: note: in instantiation of
member function 'std::basic_stringbuf<char, struct
      std::char_traits<char>, class std::allocator<char> >::str' requested here
  ...__string_type       str() const       { return _M_stringbuf.str(); }              void       str(const __string_type& __s) ...
                                                                 ^
/usr/include/c++/4.2.1/bits/basic_string.h:98:10127: note: in instantiation of
member function 'std::basic_stringstream<char, struct
      std::char_traits<char>, class std::allocator<char> >::str' requested here
  ...String StrStreamToString(StrStream* ss) {    const ::std::string& str = ss->str();   const char* const start = str.c_str(); ...
                                                                             ^
/usr/include/c++/4.2.1/bits/basic_string.h:97:5171: error: called object type
'<overloaded function type>' is not a function or
      function pointer
  ...!= __null;           node = node->next() ) {       functor(node->element());     }   }        template <typename P>   const ...
                                                        ^~~~~~~
/usr/include/c++/4.2.1/bits/basic_string.h:98:24463: note: in instantiation of
function template specialization
      'testing::internal::List<class testing::TestCase *>::ForEach<<overloaded function type> >' requested here
  ...elapsed_time_(0) {  }  UnitTestImpl::~UnitTestImpl() {    test_cases_.ForEach(internal::Delete<TestCase>); ...
                                                               ^
/usr/include/c++/4.2.1/bits/basic_string.h:97:5171: error: called object type
'<overloaded function type>' is not a function or
      function pointer
  ...!= __null;           node = node->next() ) {       functor(node->element());     }   }        template <typename P>   const ...
                                                        ^~~~~~~
/usr/include/c++/4.2.1/bits/basic_string.h:98:24516: note: in instantiation of
function template specialization
      'testing::internal::List<class testing::Environment *>::ForEach<<overloaded function type> >' requested here
  ...{    test_cases_.ForEach(internal::Delete<TestCase>);     environments_.ForEach(internal::Delete<Environment>);     delete ...
                                                               ^
Assertion failed: (Result && "declaration was not instantiated in this
scope!"), function getInstantiationOf, file
/Users/ddunbar/llvm/tools/clang/lib/Sema/Sema.h, line 3120.
0  clang             0x000000010123b47d PrintStackTrace(void*) + 38
1  clang             0x000000010123ba0b SignalHandler(int) + 336
2  libSystem.B.dylib 0x00007fff864e614a _sigtramp + 26
3  libSystem.B.dylib 0x00007fff8648acaa tiny_malloc_from_free_list + 1196
4  libSystem.B.dylib 0x00007fff86562104 __pthread_markcancel + 0
5  clang             0x0000000100473ebb
clang::Sema::LocalInstantiationScope::getInstantiationOf(clang::Decl const*) +
87
6  clang             0x000000010046b7eb
clang::Sema::FindInstantiatedDecl(clang::NamedDecl*,
clang::MultiLevelTemplateArgumentList const&) + 185
7  clang             0x00000001004459c8 (anonymous
namespace)::TemplateInstantiator::TransformDecl(clang::Decl*) + 350
8  clang             0x000000010045b1e9 clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformUnresolvedLookupExpr(clang::UnresolvedLookupExpr*)
+ 247
9  clang             0x0000000100449821 clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformExpr(clang::Expr*) + 5881
10 clang             0x000000010044dd94 clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformCallExpr(clang::CallExpr*) + 98
11 clang             0x0000000100448870 clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformExpr(clang::Expr*) + 1864
12 clang             0x000000010044d968 clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformBinaryOperator(clang::BinaryOperator*)
+ 82
13 clang             0x00000001004489a5 clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformExpr(clang::Expr*) + 2173
14 clang             0x000000010044d968 clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformBinaryOperator(clang::BinaryOperator*)
+ 82
15 clang             0x00000001004489a5 clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformExpr(clang::Expr*) + 2173
16 clang             0x000000010044d968 clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformBinaryOperator(clang::BinaryOperator*)
+ 82
17 clang             0x00000001004489a5 clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformExpr(clang::Expr*) + 2173
18 clang             0x000000010044d968 clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformBinaryOperator(clang::BinaryOperator*)
+ 82
19 clang             0x00000001004489a5 clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformExpr(clang::Expr*) + 2173
20 clang             0x000000010044d968 clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformBinaryOperator(clang::BinaryOperator*)
+ 82
21 clang             0x00000001004489a5 clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformExpr(clang::Expr*) + 2173
22 clang             0x000000010044d968 clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformBinaryOperator(clang::BinaryOperator*)
+ 82
23 clang             0x00000001004489a5 clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformExpr(clang::Expr*) + 2173
24 clang             0x000000010044d968 clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformBinaryOperator(clang::BinaryOperator*)
+ 82
25 clang             0x00000001004489a5 clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformExpr(clang::Expr*) + 2173
26 clang             0x000000010044d968 clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformBinaryOperator(clang::BinaryOperator*)
+ 82
27 clang             0x00000001004489a5 clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformExpr(clang::Expr*) + 2173
28 clang             0x000000010044d968 clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformBinaryOperator(clang::BinaryOperator*)
+ 82
29 clang             0x00000001004489a5 clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformExpr(clang::Expr*) + 2173
30 clang             0x000000010045e80e clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformIfStmt(clang::IfStmt*) + 284
31 clang             0x0000000100447119 clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformStmt(clang::Stmt*) + 1145
32 clang             0x0000000100447bde clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformCompoundStmt(clang::CompoundStmt*,
bool) + 178
33 clang             0x000000010045ce07 clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformCompoundStmt(clang::CompoundStmt*)
+ 55
34 clang             0x0000000100446f95 clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformStmt(clang::Stmt*) + 757
35 clang             0x000000010045d636 clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformForStmt(clang::ForStmt*) + 838
36 clang             0x00000001004472b5 clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformStmt(clang::Stmt*) + 1557
37 clang             0x0000000100447bde clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformCompoundStmt(clang::CompoundStmt*,
bool) + 178
38 clang             0x000000010045ce07 clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformCompoundStmt(clang::CompoundStmt*)
+ 55
39 clang             0x0000000100446f95 clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformStmt(clang::Stmt*) + 757
40 clang             0x000000010045f6ee clang::Sema::SubstStmt(clang::Stmt*,
clang::MultiLevelTemplateArgumentList const&) + 200
41 clang             0x0000000100472525
clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation,
clang::FunctionDecl*, bool, bool) + 1143
42 clang             0x0000000100471fa5
clang::Sema::PerformPendingImplicitInstantiations() + 239
43 clang             0x000000010030be37
clang::Sema::ActOnEndOfTranslationUnit() + 31
44 clang             0x0000000100587ce1
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<1>&) + 91
45 clang             0x000000010030ab45 clang::ParseAST(clang::Preprocessor&,
clang::ASTConsumer*, clang::ASTContext&, bool, bool,
clang::CodeCompleteConsumer*) + 523
46 clang             0x000000010005f2f2
clang::ASTFrontendAction::ExecuteAction() + 256
47 clang             0x000000010005f3e2 clang::FrontendAction::Execute() + 226
48 clang             0x0000000100026063 cc1_main(char const**, char const**,
char const*, void*) + 1929
49 clang             0x0000000100029ece main + 252
50 clang             0x0000000100024d64 start + 52
Stack dump:
0.  Program arguments: /Volumes/Data/ddunbar/llvm.obj.64/Debug/bin/clang -cc1 -
triple x86_64-apple-darwin10.0 -S -disable-free -main-file-name t.cpp -pic-
level 1 -mdisable-fp-elim -munwind-tables -target-cpu core2 -fno-math-errno -
resource-dir /Volumes/Data/ddunbar/llvm.obj.64/Debug/lib/clang/1.1 -fmessage-
length 134 -stack-protector 1 -fblocks -fexceptions -fdiagnostics-show-option -
o /var/folders/cl/clrOX6SaG+moCeRKEI4PtU+++TI/-Tmp-/cc-Hlw1X4.s -x c++ t.cpp
1.  <eof> parser at end of file
2.  /usr/include/c++/4.2.1/bits/basic_string.h:98:26574: instantiating function
definition 'testing::internal::ParseGoogleTestFlagsOnlyImpl'
clang: error: compiler command failed due to signal 6 (use -v to see invocation)
ddunbar@lordcrumb:delta$
--
Quuxplusone commented 14 years ago

Attached t.cpp (741309 bytes, text/plain): failing input

Quuxplusone commented 14 years ago
The same assertion is now firing when building

  llvm/utils/unittest/googletest/gtest.cc

during an LLVM build. The decl in question is a UsingShadowDecl that refers to
a FunctionDecl.
Quuxplusone commented 14 years ago

Fixed in r91928.