Udostępnij za pośrednictwem


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.

Example

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();
}