[cfe-dev] [PATCH] Using private types should be allowed as template parametter for explicit instantiation

Olivier Goffart ogoffart at kde.org
Thu Jun 17 14:41:30 PDT 2010


Hello.

Attached you will find my attempt to fix 
http://llvm.org/bugs/show_bug.cgi?id=7267

The problem is that in this code

class X { class Y; };
template<class T> struct Test {};
template<> struct Test<X::Y> {}; 

Clang would complains that X::Y is private.

While the C++ specification 14.7.2 [temp.explicit] p11
says it should compile (The usual access checking rules do not apply to names
used to specify explicit instantiations)

(This break compilation of Qt's linguist tool)


The patch is only one line but was not trivial.
By having a ParsingDeclRAIIObject while parsing that kind of close, we make 
sure any diagnostic are delayed. And because I do not call complete() on it, 
the delayed diagnostic will not be issued.

Does my patch makes sens this time?

Regards.
-- 
Olivier
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bug7267.diff
Type: text/x-patch
Size: 1500 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20100617/cf2ad987/attachment.bin>


More information about the cfe-dev mailing list