Skip to content

Latest commit

 

History

History
63 lines (51 loc) · 1.33 KB

compiler-error-c3673.md

File metadata and controls

63 lines (51 loc) · 1.33 KB
description title ms.date f1_keywords helpviewer_keywords ms.assetid
Learn more about: Compiler Error C3673
Compiler Error C3673
11/04/2016
C3673
C3673
bb6d2079-05af-4e2c-be0e-75c892e6c590

Compiler Error C3673

'type' : class does not have a copy-constructor

A user-defined constructor is needed to copy objects of CLR ref types. For more information, see C++ Stack Semantics for Reference Types.

Examples

The following sample generates C3673.

// C3673.cpp
// compile with: /clr
public ref struct R {
public:
   R() {}
   // Uncomment the following line to resolve.
   // R(R% p) {}
};

int main() {
   R r;
   R s = r;   // C3673
}

The following sample generates C3673.

// C3673_b.cpp
// compile with: /clr /c
// C3673 expected
using namespace System;
[AttributeUsage(AttributeTargets::Class)]
ref class MyAttr : public Attribute {
public:
   MyAttr() {}
   // Uncomment the following line to resolve.
   // MyAttr(int i) {}
   property int Priority;
   property int Version;
};

[MyAttr]
ref class ClassA {};   // OK, no arguments

[MyAttr(Priority = 1)]
ref class ClassB {};   // OK, named argument

[MyAttr(123)]
ref class ClassC {};   // Positional argument

[MyAttr(123, Version = 1)]
ref class ClassD {};   // Positional and named