[LLVMbugs] [Bug 9890] New: Should accept -ftemplate-depth=N with a warning
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Tue May 10 10:58:28 PDT 2011
http://llvm.org/bugs/show_bug.cgi?id=9890
Summary: Should accept -ftemplate-depth=N with a warning
Product: clang
Version: trunk
Platform: PC
OS/Version: All
Status: NEW
Severity: normal
Priority: P
Component: Driver
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: dgregor at apple.com
CC: llvmbugs at cs.uiuc.edu
For some silly reason, GCC used
-ftemplate-depth-N
rather than the more obvious
-ftemplate-depth=N
and we mimic that behavior. At the very least, we should support
-ftemplate-depth=N
as an alias (and perhaps provide a warning at the driver level).
To see why:
$ cat test.cpp
template<bool b, int t, int f>
struct _if {
static const int result = f;
};
template<int t, int f>
struct _if<true, t, f> {
static const int result = t;
};
template<int i>
struct fact {
static const int result = _if<i == 0, 1, i*fact<i - 1>::result>::result;
};
int main()
{
int a = fact<4>::result;
}
$ clang++ -ftemplate-depth=100 test.cpp
clang: error: unable to execute command: Segmentation fault: 11
clang: error: clang frontend command failed due to signal 1 (use -v to see
invocation)
--
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