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 @@ -6591,7 +6591,7 @@ } // See if trivial_abi has to be dropped. - if (Record->hasAttr()) + if (!Record->isDependentType() && Record->hasAttr()) checkIllFormedTrivialABIStruct(*Record); // Set HasTrivialSpecialMemberForCall if the record has attribute 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 &&); };