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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T01:56:14+00:00 2026-06-06T01:56:14+00:00

Paragraph 7.3.3. of C++2003 standard states that Using declaration for a class member shall

  • 0

Paragraph 7.3.3. of C++2003 standard states that

Using declaration for a class member shall be a member declaration.

This means that the following gives a syntax error:

struct S1
{
    static int var1;
};

using S1::var1;

While the following compiles fine:

namespace N2
{
    int var2;
}

using N2::var2;

Does anybody know the rationale (if any) behind that?

Even more, the standard gives explicit example with static data member of the struct and tells that it should cause syntax error. MS C++ gives this error:

cpptest1.cxx(9) : error C2885: ‘S1::var1’: not a valid using-declaration at non-class scope

It is still not clear why this should be banned.

  • 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-06-06T01:56:16+00:00Added an answer on June 6, 2026 at 1:56 am

    The reason it doesn’t work is simply because the Standard forbids it. Pay special attention to s in the example:

    enter image description here

    As a workaround, you can say:

    auto& var = S1::var;
    

    Making the Standard (and therefore all compilers) more complicated to handle an unusual case that has a convenient workaround just doesn’t pass the cost-benefit test.

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

Sidebar

Related Questions

this is a sample paragraph for Word 2003 XML. The problem is, how do
in the following paragraph: The instruction set requires that loads and stores from local
How to give paragraph effect to my paragraph using CSS? For example: This is
I have a big paragraph of text that is divided into subparagraphs with <br>
I have a paragraph of text below that I want to use an input
I have a paragraph of text and i want to replace some words using
I am using Regex to retrieve a paragraph. My paragraph in my string variable
Why first paragraph not taking this style p:first-child #content p:first-child {color:#4C4C4C; font-size:1.2em; font-weight:bold; line-height:1.8;
I read the following paragraph on Wikipedia article about the CLR: Alternatively, the CIL
I have a div.infotext with one paragraph inside. I animate the height of that

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.