This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Trying to find a link for information about parsing template parameters and the >> problem
On Mon, Apr 1, 2013 at 8:55 AM, Alec Teal <a.teal@warwick.ac.uk> wrote:
>
> I'm still planning to rewrite the c++ parser in GCC, right now I am still researching, I remember a page that talked about the problems of parsing > in nested templates, and I cannot find the link!
>
> Searching for it has yielded people asking questions about errors where >> occurs.
>
> Please provide me with the link.
I'm not sure this kind of message really belongs on the
gcc@gcc.gnu.org mailing list, which is for issues related to the
development of GCC. I understand that you are looking at rewriting
the C++ parser (why?) but this is just a basic C++ question, not a GCC
issue.
I don't have a link, but it seems to me that the issue is obvious.
The C++ lexer recognizes >> as a single token. So when you write
std::vector<std::vector<int>>
the final >> is parsed as a single token, rather than the two separate
tokens that the parser expects.
Note that this issue is fixed in C++11.
Ian