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 6320275
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T15:56:32+00:00 2026-05-24T15:56:32+00:00

As a follow-up to What is this crazy C++11 syntax ==> struct : bar

  • 0

As a follow-up to ” What is this crazy C++11 syntax ==> struct : bar {} foo {};? “, I’d expect the following C++0x code to compile:

struct x {};
struct :::x {} y {};

However, GCC 4.7.0 20110731 tells me:

error: global qualification of class name is invalid before ‘:’ token

And when I take a step back towards sanity and give the second UDT a name:

struct x {};
struct a:::x {} y{}; // remember, identical to `a::: x` or `a: ::x` or `a:: :x` etc

the error is:

error: ‘a’ has not been declared


It seems like the three colons are being lexed like <::> <:> rather than <:> <::>, but can this clearly be deduced from the [final draft] standard?

And might the question ” Global qualification in a class declarations class-head ” be related?

  • 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-24T15:56:33+00:00Added an answer on May 24, 2026 at 3:56 pm

    This is just to do with parsing. From §2.5.3

    If the input stream has been parsed into preprocessing tokens up to a given character, the next preprocessing token is the longest sequence of characters that could constitute a preprocessing token, even if that would cause further lexical analysis to fail.

    Basically, it has to take the longest sequence of characters, so ::: is always parsed as :: : in the same way that x+++y is always parsed as x ++ + y.

    This is referred to as Maximal Munch parsing.

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

Sidebar

Related Questions

I follow this rule but some of my colleagues disagree with it and argue
I am trying to follow this tutorial on how to connect to a database
I am trying to follow this example (from p137 of Rob Pickering's Foundations of
I tried to follow this but the default modelbinder let my array null on
Trying to follow this example. (Section String sorting...) Is there anything obvious that would
I have a bunch of python methods that follow this pattern: def delete_session(guid): conn
There are a few windows service projects in our codebase that follow this model,
I checked out the three20 source and was trying to follow this guide to
I want to include Core Location and I'm trying to follow this tutorial: http://www.mobileorchard.com/hello-there-a-corelocation-tutorial/
Update: Check out this follow-up question: Gem Update on Windows - is it broken?

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.