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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T20:00:58+00:00 2026-06-07T20:00:58+00:00

In Visual Studio 2012RC there are some non-standard extensions. For example this code compiles:

  • 0

In Visual Studio 2012RC there are some non-standard extensions. For example this code compiles:

#include <string>

using namespace std;

void value(string& value)
{
    value = "some";
}

int main()
{
    value(string("nice"));
}

and get warning that it is non-standard extension. So, I want to understand, how it’s real and how code transforms (rvalue-reference or const reference with const_cast)?

  • 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-07T20:00:59+00:00Added an answer on June 7, 2026 at 8:00 pm

    A temporary object of class type is still an object. It lives somewhere in memory, which means that there’s nothing unusual in the compiler being able to attach a reference to it. At physical level whether it is a const reference or non-const reference makes no difference. In other words, in cases like that the language restriction is purely conceptual, artificial. The compiler simply ignores that restriction. There’s no need to “transform” anything here. The reference is simply attached directly to the object, wherever that object happens to reside.

    Basically, for a class that provides the outside word with access to the value of its this pointer (or with lvalue access to *this) the behavior can be immediately and easily simulated

    struct S {
      S& get_lvalue() { return *this; }
    };
    
    void foo(S& s);
    ...
    
    foo(S().get_lvalue());
    

    The above code is perfectly legal and it works around the aforementioned restriction. You can think of MSVC++ behavior as being equivalent to this.

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

Sidebar

Related Questions

Visual studio 2008 isn't catching syntax errors. for example: Tpc_feed(void); compiles fine. this: Tpc_feed(void);;;;;;;
Visual Studio keeps trying to indent the code inside namespaces. For example: namespace Foo
visual studio has an excellent feature for manual code folding by using regions. i
Visual Studio 2005. I was converting some of my source code to C#. However,
Visual Studio 2010 seems to be mixing up the above mentioned libraries. This code
Started using Visual Studio 2012 RC since yesterday, We have one WCF solution. Whenever
I have installed Visual Studio 2012 RC. I would like to find any example
I'm using SOAP through Visual Studio 2012 RC with C# to use the Magento
I am currently developing on Visual Studio 2012 RC using TFS Preview for source
I am using Visual Studio Express 2012 RC. If a create a blank hello

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.