ufcpp / NonCopyableAnalyzer

An analyzer for Non-Copyable structs.
MIT License
29 stars 4 forks source link

generics #8

Closed ufcpp closed 6 years ago

ufcpp commented 6 years ago

How should the analyzer treat generics? disallowed?

static void Main()
{
    NonCopyableStruct x = new NonCopyableStruct();
    var illegal = x; // ❌
    var misjudged = Copy(x); // logically ❌ but allowed in current implementation
}

public static T Copy<T>(in T x) => x;

interface annotation? https://github.com/ufcpp/NonCopyableAnalyzer/issues/1

ufcpp commented 6 years ago

https://github.com/ufcpp/NonCopyableAnalyzer/commit/da850f04a15d8e6ad037ca6fc15bed17a54707a9