[LLVMbugs] [Bug 12439] New: Nested template using definitions containing the sizeof... operator crashes frontend

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Apr 2 09:01:04 PDT 2012


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

             Bug #: 12439
           Summary: Nested template using definitions containing the
                    sizeof... operator crashes frontend
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: llvm-bugs at quasiparticle.net
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Wrapping sizeof... expression in template using typedefinitions crashes the
frontend.

Take the following code:

template<class... Members>
struct X {
    template<int Idx>
    using get_t = decltype(sizeof...(Members)); // decltype(0), int, and others
work

    template<int i>
    get_t<i> get();
};

template<class... Members>
template<int i>
X<Members...>::get_t<i> X<Members...>::get()
{
    return 0;
}

The frontend crashes while compiling this:

Stack dump:
0.    Program arguments: /usr/bin/clang-3.1 -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free
-disable-llvm-verifier -main-file-name bar.cpp -mrelocation-model static
-mdisable-fp-elim -masm-verbose -mconstructor-aliases -munwind-tables
-target-cpu x86-64 -momit-leaf-frame-pointer -resource-dir
/usr/bin/../lib/clang/3.1 -fmodule-cache-path /var/tmp/clang-module-cache
-internal-isystem
/usr/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.6.3/../../../../include/c++/4.6.3
-internal-isystem
/usr/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.6.3/../../../../include/c++/4.6.3/x86_64-unknown-linux-gnu
-internal-isystem
/usr/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.6.3/../../../../include/c++/4.6.3/backward
-internal-isystem /usr/local/include -internal-isystem
/usr/bin/../lib/clang/3.1/include -internal-externc-isystem /include
-internal-externc-isystem /usr/include -W -pedantic -std=c++11
-fdeprecated-macro -fdebug-compilation-dir /dev/shm -ferror-limit 19
-fmessage-length 65 -mstackrealign -fgnu-runtime -fobjc-runtime-has-arc
-fobjc-runtime-has-weak -fobjc-fragile-abi -fcxx-exceptions -fexceptions
-fdiagnostics-show-option -fcolor-diagnostics -o /tmp/bar-bLrFHp.o -x c++
bar.cpp 
1.    bar.cpp:7:2: at annotation token 
2.    bar.cpp:2:1: parsing struct/union/class body 'X'
clang-3: error: unable to execute command: Segmentation fault (core dumped)
clang-3: error: clang frontend command failed due to signal (use -v to see
invocation)
clang-3: note: diagnostic msg: Please submit a bug report to  and include
command line arguments and all diagnostic information.
clang-3: note: diagnostic msg: Preprocessed source(s) and associated run
script(s) are located at:
clang-3: note: diagnostic msg: /tmp/bar-dDTBb3.ii
clang-3: note: diagnostic msg: /tmp/bar-dDTBb3.sh

-- 
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