[LLVMbugs] [Bug 7863] New: Function template and ?: causes segfault

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Aug 10 11:11:34 PDT 2010


           Summary: Function template and ?: causes segfault
           Product: clang
           Version: 2.7
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: sjackman at gmail.com
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com

The test case and error follow:

#include <algorithm>

struct Foo {
    Foo(const char* s) { }

struct Bar {
    Bar(const char* s) { }

template<class X>
void ook(const char* s)
    X x(s);

int main(int argc, const char** argv)
    void (*f)(const char*) = argc > 1 ? ook<Foo> : ook<Bar>;
    std::for_each(argv, argv + argc, f);

0  clang 0x08dc65c8
Stack dump:
0.      Program arguments: /usr/bin/clang -cc1 -triple i386-pc-linux-gnu -S
-disable-free -disable-llvm-verifier -main-file-name foo.cc -mrelocation-model
static -mdisable-fp-elim -mconstructor-aliases -target-cpu pentium4
-resource-dir /usr/lib/clang/1.1 -fmessage-length 80 -fexceptions -fgnu-runtime
-fdiagnostics-show-option -fcolor-diagnostics -o /tmp/cc-9UMvWs.s -x c++ foo.cc 
1.      foo.cc:17:57: current parser token ';'
2.      foo.cc:16:1: parsing function body 'main'
3.      foo.cc:16:1: in compound statement ('{}')
clang: error: compiler command failed due to signal 11 (use -v to see

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