Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

Compiler Warning (level 1) C4836

Error Message

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 {
   void f() {
      struct S {};
      TA<S> ta;   // C4836

int main() {
   R r;

Community Additions

© 2015 Microsoft