Export (0) Print
Expand All
Expand Minimize
1 out of 4 rated this helpful - Rate this topic

Compiler Warning (level 4) C4238

Error Message

nonstandard extension used : class rvalue used as lvalue

For compatibility with previous versions of Visual C++, Microsoft extensions (/Ze) allow you to use a class type as an rvalue in a context that implicitly or explicitly takes its address. In some cases, such as the example below, this can be dangerous.


// C4238.cpp
// compile with: /W4 /c
struct C {
   C() {}

C * pC = &C();   // C4238

This usage causes an error under ANSI compatibility (/Za).

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

© 2014 Microsoft. All rights reserved.