[LLVMbugs] [Bug 7724] New: clang++ asserts during compilation of if statement with compound conditional in C++ code

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Jul 27 10:27:04 PDT 2010


           Summary: clang++ asserts during compilation of if statement
                    with compound conditional in C++ code
           Product: clang
           Version: trunk
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: release blocker
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: mike.jackson at bluequartz.net
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com

// Begin Code
#include <iostream>

int GetSwapBytes() { return 1; }

template<typename OT>
int myMethod()
if (GetSwapBytes() && sizeof(OT) > 1) // <=== HERE IS THE PROBLEM
    std::cout << "sizeof(OT) == 4" << std::endl;
  return 1;

int main (int argc, char const *argv[])
  int ret = myMethod<int>();  
  return 0;

The above code will cause clang++ to assert during compiling. The assertion is:

595:[mjackson at ferb:clang]$ clang++ ~/Desktop/test.cpp -o ~/Desktop/clang-test
Assertion failed: (!isDependentType() && "This doesn't make sense for dependent
types"), function isConstantSizeType, file
/Users/Shared/OpenSource/llvm/tools/clang/lib/AST/Type.cpp, line 616.
Stack dump:
0.    Program arguments: /Users/Shared/OpenSource/llvm/Build/bin/clang -cc1
-triple i386-apple-darwin9.0.0 -emit-obj -mrelax-all -disable-free
-main-file-name test.cpp -pic-level 1 -mdisable-fp-elim -masm-verbose
-target-cpu yonah -resource-dir
/Users/Shared/OpenSource/llvm/Build/lib/clang/2.8 -ferror-limit 19
-fmessage-length 148 -fblocks -fexceptions -fdiagnostics-show-option
-fcolor-diagnostics -o
/var/folders/Zm/ZmwaqVZrGbee7mHKbefzNU+++TI/-Tmp-/cc-v8OIWq.o -x c++
1.    /Users/mjackson/Desktop/test.cpp:51:37: current parser token ')'
2.    /Users/mjackson/Desktop/test.cpp:50:1: parsing function body 'myMethod'
3.    /Users/mjackson/Desktop/test.cpp:50:1: in compound statement ('{}')
clang: error: clang frontend command failed due to signal 6 (use -v to see

GCC and Visual Studio 2008 both compile this code cleanly.

LLVM and Clang both checked out from svn on July 27,2010 at about 10:00 AM EST.
Built using GCC 4.2 on OS X 10.5.8 using standard Xcode 3.1.4 tools.

clang++ --version
clang version 2.8 (trunk 109508)
Target: i386-apple-darwin9
Thread model: posix

Mike Jackson

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