digitalmars.D.bugs - [Issue 2510] New: provide a template instantiation backtrace when compile fails in a template
- d-bugmail puremagic.com (36/36) Dec 12 2008 http://d.puremagic.com/issues/show_bug.cgi?id=2510
- d-bugmail puremagic.com (11/11) Dec 13 2008 http://d.puremagic.com/issues/show_bug.cgi?id=2510
- d-bugmail puremagic.com (8/8) Apr 26 2009 http://d.puremagic.com/issues/show_bug.cgi?id=2510
- d-bugmail puremagic.com (21/21) Sep 26 2009 http://d.puremagic.com/issues/show_bug.cgi?id=2510
- d-bugmail puremagic.com (11/11) Jan 13 2010 http://d.puremagic.com/issues/show_bug.cgi?id=2510
- d-bugmail puremagic.com (11/11) Jan 20 2010 http://d.puremagic.com/issues/show_bug.cgi?id=2510
http://d.puremagic.com/issues/show_bug.cgi?id=2510
Summary: provide a template instantiation backtrace when compile
fails in a template
Product: D
Version: 1.038
Platform: PC
OS/Version: Windows
Status: NEW
Severity: enhancement
Priority: P2
Component: DMD
AssignedTo: bugzilla digitalmars.com
ReportedBy: wbaxter gmail.com
It's very annoying to get a compiler message that consists of nothing but:
" error: ATemplateFunction: int does not have a .length property"
Where ATemplateFunction is something like
void ATemplateFunction(ArrayT)(ArrayT x) {
auto n = x.length;
....
}
Great so I know that *somewhere* in all my source code I called
ATemplateFunction with the wrong kind of argument. The compiler knows where it
was that I made the call, but it just doesn't care to enlighten me. Very
frustrating.
I seem to recall a discussion at one point where Walter said that template
instantiation backtraces make template errors look too complicated. And I can
see the reasoning in that, but omitting them entirely is like chopping off the
developer's legs just because his toes are cold.
So I have a couple of suggestions:
1) Only print the backtrace when compiling with -v. That way most of the time
you don't have to see it. Only when you're really stuck will you pull out the
-v guns to figure out what the issue is.
2) Just print out an abbreviated backtrace that consists of only file names and
line numbers.
3) Do some combination of 1 and 2.
--
Dec 12 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2510 ------- Created an attachment (id=281) --> (http://d.puremagic.com/issues/attachment.cgi?id=281&action=view) add basic template instantiation traces We've added this to LDC a while back and I've attached the original diff. It doesn't cover all cases, but should at least provide a trace for a significant number of in-template errors. In order to not spam users, we only print long traces completely when -v is given. Otherwise only the first and last three steps in the chain are shown. --
Dec 13 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2510
fvbommel wxs.nl changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |someanon yahoo.com
*** Bug 2902 has been marked as a duplicate of this bug. ***
--
Apr 26 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2510
Stewart Gordon <smjg iname.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |smjg iname.com
You have the same typo in three different places:
fprintf(stdmsg," instantiatied in %s: %s\n", cur->loc.toChars(),
cur->toChars());
instantiatied -> instantiated
And
while(cur = cur->tinst)
probably ought to be written
while((cur = cur->tinst) != NULL)
to avoid triggering a "possibly incorrect assignment" warning in some
compilers.
But I like the idea of defaulting to showing the three instantiation levels at
each end of the chain.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 26 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2510
Don <clugdbug yahoo.com.au> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |clugdbug yahoo.com.au
I think this was fixed in the last release, as part of the 'static assert'
patch. Please confirm.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 13 2010
http://d.puremagic.com/issues/show_bug.cgi?id=2510
Don <clugdbug yahoo.com.au> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
Fixed DMD1.054 and 2.038.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 20 2010









d-bugmail puremagic.com 