Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5974711
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T20:58:49+00:00 2026-05-22T20:58:49+00:00

>>> is lexed as >> > . But what happens if the first >

  • 0

>>> is lexed as >> >. But what happens if the first > closes a template argument list, should the result be equivalent to > > > or > >>?

It does matter in the following code:

template<class T> struct X { };

void operator >>(const X<int>&, int) { }

int main() {
    *new X<int>>> 1;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T20:58:50+00:00Added an answer on May 22, 2026 at 8:58 pm

    The text of the FDIS says

    Similarly, the first non-nested >> is treated as two consecutive but distinct > tokens

    It cannot unlex tokens and relex. So this will be a > > >. Note that the input to a C++ implementation is first lexed into preprocessing tokens, and then those tokens are converted into C++ tokens. So first your input are the C++ tokens >> >, then the C++ parser changes these to > > >.

    Each preprocessing token is converted into a token. (2.7). The resulting tokens are syntactically and semantically analyzed and translated as a translation unit. [ Note: The process of analyzing and translating the tokens may occasionally result in one token being replaced by a sequence of other tokens (14.2). — end note ]

    There’s no chance you could merge those two trailing > > tokens.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

this code is the base of lexer , and it does the basic operation
I am getting the following warning from my Java code: Lexer.java:591: warning: [unchecked] unchecked
I try to make my evoque templates color-code a bit, but the html I
This is my first question here, but I hope I will get a lot
gawk '/<Lexer>/,/<\/Lexer>/' file this works but it prints the first and last records, which
I have a lexer built that streams out tokens from in input but I'm
I'm writing a lexer in haskell. Here's the code: lexer :: String -> [Token]
How does a lexer solve this ambiguity? /*/*/ How is it that it doesn't
I'm currently looking for a lexer/parser that generates Scala code from a BNF grammar
maybe I'm just failing in a really simple thing but I'm developing an intepreter

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.