[cfe-dev] Incorrect source range for specialized template VarDecl declaration

Will Wilson will at indefiant.com
Tue Jan 8 16:11:27 PST 2013


> > 1. I assume the same is true for the whole if-else block in
> > CheckMemberSpecialization() that applies TSK_ExplicitSpecialization for
> > various Decl types?
>
> Yes, those calls to setLocation all look wrong. Do you see any test
> failures if you remove them?


Failing Tests (5):
    Clang :: CXX/temp/temp.spec/temp.expl.spec/p2-0x.cpp
    Clang :: CXX/temp/temp.spec/temp.expl.spec/p2.cpp
    Clang :: CXX/temp/temp.spec/temp.expl.spec/p5.cpp
    Clang :: CXX/temp/temp.spec/temp.explicit/p4.cpp
    Clang :: SemaCXX/warn-unused-filescoped.cpp

It looks like a few diagnostics rely on the location data. All of the fails
seem to be composed of the diagnostics moving from the specialization to
the declaration (from test/CXX/temp/temp.spec/temp.expl.spec/p5.cpp):

error: 'note' diagnostics expected but not seen:
  Line 31: forward declaration
error: 'note' diagnostics seen but not expected:
  Line 15: forward declaration of 'X<IntHolder, long>::Inner'
2 errors generated.

Obviously the tests could be fairly easily updated but it seems there's
more than a little danger of adversely affecting utility of the
diagnostics. I guess the diagnostics would have to be reworked to ensure
they resolved the explicitly specialized definition rather than declaration
location - which sounds like it might be a fair bit of work...


> > 2. Where should any tests for this change live?
>
> test/SemaCXX/sourceranges.cpp looks like a good candidate.


Looks good. A few more test cases wouldn't go amiss looking at it ;)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130109/e8022d45/attachment.html>


More information about the cfe-dev mailing list