[LLVMbugs] [Bug 9937] New: Incorrect parse of simple-declaration containing two type-name template-ids

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue May 17 12:03:44 PDT 2011


http://llvm.org/bugs/show_bug.cgi?id=9937

           Summary: Incorrect parse of simple-declaration containing two
                    type-name template-ids
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: schaub.johannes at googlemail.com
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


The following parses incorrectly in Clang:

template<typename T>
struct A { };

namespace N {
A<int> A<int>();
}

The second "A<int>" should not belong to the decl-specifier-seq, but to the
init-declarator, and be the declarator-id of the simple-declaration.

It can be argued what the better error message ("cannot combine with previous
'type-name' declaration specifier" as it is now, or "template specialization
requires 'template<>'" as it would if clang would parse it correctly), but it
should be considered:

- Is the existing diagnostic better than what we would get if we parsed it
correctly? Are both equally bad?
- Can there be well-formed code that would be made ill-formed by the current
parse? (I can't think of any).
- Is the advantage of having a better diagnostic worth parsing this and other
(afaics) ill-formed code the way it's parsed?

I don't have strong opinions about this, but I thought I would open a PR about
it, so it can be considered generally :)

-- 
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.



More information about the llvm-bugs mailing list