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: [email protected]
ReportedBy: [email protected]
CC: [email protected]
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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs