Boost logo

Boost :

Subject: Re: [boost] [Config] N3276 decltype support on VC++ 11
From: Stephan T. Lavavej (stl_at_[hidden])
Date: 2012-09-05 17:51:30

[Michel Morin]
> IIRC, Stephan said that VC++ 11 supports N3276 decltype.


[Marshall Clow]
> What we need to do is to figure out the differences between VC10 and VC11 and update the VC config for that. is the Rosetta Stone - it is accurate to the best of my ability. There is one caveat - rvalue references v2.1 was not completely implemented (it is still tracked by an active bug). This demonstrates what works and what doesn't:

C:\Temp>type meow.cpp
#include <stdio.h>
#include <string>
using namespace std;

void foo(const string&) {
    puts("foo(const string&)");

void foo(string&&) {

#ifdef BAR
void bar(long&&) {

int main() {

#ifdef BAR
    int x = 1729;

C:\Temp>cl /EHsc /nologo /W4 /MTd meow.cpp


C:\Temp>cl /EHsc /nologo /W4 /MTd /DBAR meow.cpp
meow.cpp(24) : error C2664: 'bar' : cannot convert parameter 1 from 'int' to 'long &&'
        You cannot bind an lvalue to an rvalue reference

C++11 and VC11 agree that foo(string&&) should be selected (the string literal is an lvalue, but the temporary std::string is an rvalue).

C++11 says that bar(long&&) should be invoked (int x is an lvalue, but the temporary long is an rvalue), but VC11 rejects this. That's the remaining bug.

Hope this helps,

Boost list run by bdawes at, gregod at, cpdaniel at, john at