You are on page 1of 3

Limitations and Breaking Changes in Visual

C++ Compiler November 2013 CTP


Limitations
The features provided in this compiler are not guaranteed to work correctly with the certain other Visual
Studio and Visual C++ Compiler features.
Visual Studio IDE and IntelliSense
New syntax introduced in this release might cause Visual Studios editor and IntelliSense to fail or
behave incorrectly.
Static Analysis
Compiling using /analyze is not supported. Doing so will likely result in internal compiler errors.
Debugging
The debuggers behavior might be surprising or erroneous when encountering code that uses new
features in this release.
Await
This feature utilizes mechanisms provided by the underlying operating system. It can only be used on
machines running Windows 8.1 or later.
Noexcept
In this release the implementation of noexcept does not call std::terminate when an exception crosses a
noexcept function boundary. Instead, the search continues up the call stack until a handler is found or it
reaches the outermost function.
Behavior Changes
The following is a list of behavior changes with respect to Visual C++ Compiler 2013 RTM.
Destructors implicitly marked noexcept
Description:
User-declared destructors may be implicitly marked noexcept in some cases. This could lead to the
following behaviors:
Use of throw in such a destructor will trigger warning C4297: function assumed to not throw an
exception but does.
Use of __forceinline on such a destructor will not work if the destructor calls functions not
marked noexcept because it would use exception semantics, triggering error C4981: function
marked as __forceinline not inlined. __forceinline will work on such a destructor if every
function it calls is marked noexcept.
Use of structured exception handling in such a destructor triggers error C2713: only one kind of
exception handling permitted in a function.
Use of explicit exception specifications on such a destructor may trigger error C2694: function
has less-restrictive exception specification than base class virtual member function.
Impact:
High.
Mitigation:
Avoid destructors that throw exceptions.
Implicitly declared special member functions
Description:
There are some new rules that regulate the behaviors of implicitly declared special member functions:
Previous versions of Visual C++ would define special member functions even if the definition
would be ill-formed. For example, in the case that an implicit definition would have to call an
inaccessible base member function. The previous compiler diagnosed the use of such implicit
functions accordingly. The current compiler will mark such special member function as deleted
instead, as required by the C++ standard. This leads to better diagnostics but it may also
indirectly impact code that violates other rules related to deleted functions. For example, a
private virtual destructor will result in a deleted destructor in a derived class; if the base
destructor is not deleted then it may trigger C2282: deleted function cannot override a non-
deleted virtual function. Example:
class B {
private:
B() {}
};

class D : public B {
};

D obj;

With Dev12 RTM, D::D() is ill-formed and will be diagnosed accordingly:
tmp.cpp(10) : error C2248: 'B::B' : cannot access private member
declared in class 'B'
tmp.cpp(5) : see declaration of 'B::B'
tmp.cpp(3) : see declaration of 'B'
This diagnostic occurred in the compiler generated function
'D::D(void)'

With the CTP compiler, D::D() will be implicitly defined as deleted:
tmp.cpp(12) : error C2280: 'D::D(void)' : attempting to reference a
deleted function
tmp.cpp(10) : compiler has generated 'D::D' here

If any move operation (move constructor or assignment operator) is user-declared, then the
implicit copy constructor and assignment operator will be defined as deleted, effectively making
the type move-only. Attempting to copy instances of such types will trigger C2280: attempting
to reference a deleted function. Example:
struct A {
A();
A(A&&);
};

A g;

A foo(A a)
{
g = a;
return g;
}

With Dev12 RTM, the snippet above compiles fine.
With the CTP compiler, the copy constructor A::A(const A&) and assignment operator
A::operator=(const A&) are implicitly deleted:
tmp.cpp(11) : error C2280: 'A &A::operator =(const A &)' : attempting to
reference a deleted function
tmp.cpp(5) : compiler has generated 'A::operator =' here
tmp.cpp(12) : error C2280: 'A::A(const A &)' : attempting to reference a
deleted function
tmp.cpp(5) : compiler has generated 'A::A' here
Impact:
Medium.
Mitigation:
To restore the copy operations, the copy constructor and assignment operator can be explicitly
defaulted.
Format string warnings for printf
Description:
When compiling on AMD64 machines, uses of printf with not enough arguments will cause warning
C4317: not enough arguments passed for format string. Note that this warning is valid in these cases;
the change is that previous versions of the compiler might fail to issue this warning.
Impact:
Low.
Mitigation:
Always provide the correct number of arguments to printf and other functions in its family.

You might also like