[PATCH] D15228: [PATCH] New diagnostic for non-idiomatic copy or move operations

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 4 08:37:39 PST 2015


aaron.ballman added a comment.

As I wade through a lot of diagnostics from our test suite, I notice a recurring pattern is that this is diagnosing in the presence of idiomatic constructors or assignment operators. e.g.,

  struct S {
    S(const S&) = delete;
    S(S&); // We diagnose, and suggest const T& here
  };
  
  struct T {
    T(const T&) = default;
    T(T&); // We diagnose, and suggest const T& here
  };

Would it make sense to delay this checking until the class definition is complete, and then diagnose only the operations where the suggestion in the diagnostic would not result in an ambiguous declaration? Or, perhaps suppress the diagnostic entirely in the presence of multiple overloads of the operation. e.g, not diagnose the following:

  struct U {
    U(U&);
    U(volatile U&);
  
    U& operator=(U&);
    void operator=(const U&);
  };


http://reviews.llvm.org/D15228





More information about the cfe-commits mailing list