Export (0) Print
Expand All
Expand Minimize
This topic has not yet been rated - Rate this topic

Compiler Warning (level 1) C4836

nonstandard extension used : 'type' : local types or unnamed types cannot be used as template arguments

The C++ standard does not allow the use of local types as template arguments, but the Visual C++ compiler does allow this under /Ze. C4836 is an informational warning, to let you know that you are writing non-conformant code. For more information, see /Za, /Ze (Disable Language Extensions).

C4836 is off by default. See Compiler Warnings That Are Off by Default for more information.

The following sample generates C4836.

// C4836.cpp
// compile with: /W1
#pragma warning(default:4836)
template <class T>
struct TA {};

struct R {
public:
   void f() {
      struct S {};
      TA<S> ta;   // C4836
   }
};

int main() {
   R r;
   r.f();
}
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.