[LLVMbugs] [Bug 12262] New: Crash in constexpr function when initializing array

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Mar 13 04:01:44 PDT 2012


http://llvm.org/bugs/show_bug.cgi?id=12262

             Bug #: 12262
           Summary: Crash in constexpr function when initializing array
           Product: clang
           Version: trunk
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++0x
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: jonathan.sauer at gmx.de
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Created attachment 8205
  --> http://llvm.org/bugs/attachment.cgi?id=8205
Full crash log

When trying out the interesting Sprout Library
(<https://github.com/bolero-MURAKAMI/Sprout>), I found that the following
reduced test case crashes clang r152615:

template<typename T>
constexpr T&& forward(T& t) noexcept {
  return static_cast<T&&>(t);
}

template <typename T, unsigned N>
class array {
public:
  T elems[N ? N : 1];
};

template<typename T, typename... Types>
constexpr array<T, sizeof...(Types)> make_array(Types&&... args) {
 return array<T, sizeof...(Types)>{{forward<Types>(args)...}};
}

constexpr auto arr2 = make_array<int>(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);


This results in (full crash log attached):

$ $ ~/LLVM/build/Release+Asserts/bin/clang++ -std=c++11 -v clang.cpp

clang version 3.1 (trunk 152615)
Target: x86_64-apple-darwin10.8.0
Thread model: posix
[...]
Assertion failed: (isa<LabelDecl>(D) && "declaration not instantiated in this
scope"), function findInstantiationOf, file
/Users/rynnsauer/LLVM/llvm/tools/clang/lib/Sema/SemaTemplateInstantiate.cpp,
line 2361.
[...]

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list