Hi,
Doug, you right. MatchTemplateParametersToScopeSpecifier is unneccessary here.
Matthieu, I have VS2008EE installed in my Virtual Box. It also reports errors for all cases of "template-keyword + member-field" usage.
Please find the fixed patch.
--
Regards,
Stepan
19.09.2011, 20:58, "Matthieu Monrocq" <[email protected]>:


2011/9/19 Douglas Gregor <[email protected]>
Hello Stepan,

On Sep 15, 2011, at 1:28 PM, Stepan Dyatkovskiy wrote:

> C++ does not allow member templates. Clang doesn't check for this case and crash.
>
> Please find attach the patch which fixes this.

+    // FIXME: Check that the name is an identifier!
+    IdentifierInfo *II = Name.getAsIdentifierInfo();
+
+    // Match up the template parameter lists with the scope specifier, then
+    // determine whether we have a template or a template specialization.
+    bool isExplicitSpecialization = false;
+    bool Invalid = false;
+    if (TemplateParameterList *TemplateParams =
+          MatchTemplateParametersToScopeSpecifier(
+                                D.getDeclSpec().getSourceRange().getBegin(),
+                                D.getIdentifierLoc(),
+                                D.getCXXScopeSpec(),
+                                TemplateParameterLists.get(),
+                                TemplateParameterLists.size(),
+                                /*never a friend*/false,
+                                isExplicitSpecialization,
+                                Invalid)) {

Why are we even trying to match up the template parameter lists here? One isn't allowed to write a specialization inside a class, much less a specialization that looks like a variable. Couldn't this be a simpler "is there a template parameter list" check?

       - Doug
 
Does not MSVC allow member function templates to be specialized within the class directly ?

-- Matthieu.

Attachment: bugfix10896.patch
Description: Binary data

_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to