diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -9719,6 +9719,11 @@ // Ill-formed if the copy and move constructors are deleted. auto HasNonDeletedCopyOrMoveConstructor = [&]() { + // If we know there exist users-defined move/copy ctors, don't try to infer + // the deletion of implicit ones becausee Sema may not have the info yet. + if (RD.hasUserDeclaredMoveConstructor() || + RD.hasUserDeclaredCopyConstructor()) + return true; if (RD.needsImplicitCopyConstructor() && !RD.defaultedCopyConstructorIsDeleted()) return true; diff --git a/clang/test/SemaCXX/trivial-abi-templated-type.cpp b/clang/test/SemaCXX/trivial-abi-templated-type.cpp new file mode 100644 --- /dev/null +++ b/clang/test/SemaCXX/trivial-abi-templated-type.cpp @@ -0,0 +1,5 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11 +// expected-no-diagnostics + +template +class __attribute__((trivial_abi)) a { a(a &&); };