Hi, This broke our clang builds with
$ gcc --version gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-36) on CentOS Linux release 7.6.1810 (Core), [ 23%] Building CXX object tools/clang/lib/Basic/CMakeFiles/clangBasic.dir/Module.cpp.o In file included from include/llvm/ADT/StringMap.h:20:0, from include/llvm/Support/Host.h:16, from include/llvm/ADT/Hashing.h:48, from include/llvm/ADT/ArrayRef.h:12, from include/llvm/ADT/DenseMapInfo.h:16, from include/llvm/ADT/DenseMap.h:16, from tools/clang/include/clang/Basic/FileManager.h:19, from tools/clang/include/clang/Basic/Module.h:18, from tools/clang/lib/Basic/Module.cpp:14: include/llvm/Support/PointerLikeTypeTraits.h: In instantiation of ‘struct llvm::PointerLikeTypeTraits<clang::Module*>’: /usr/include/c++/4.8.2/type_traits:1087:41: required by substitution of ‘template<class _Tp1, class _Up1> static decltype (((declval<_Tp1>)()=(declval<_Up1>)(), std::__sfinae_types::__one())) std::__is_assignable_helper<_Tp, _Up>::__test(int) [with _Tp1 = _Tp1; _Up1 = _Up1; _Tp = llvm::detail::trivial_helper<llvm::PointerIntPair<clang::Module*, 1u, bool> >&; _Up = const llvm::detail::trivial_helper<llvm::PointerIntPair<clang::Module*, 1u, bool> >&] [with _Tp1 = llvm::detail::trivial_helper<llvm::PointerIntPair<clang::Module*, 1u, bool> >&; _Up1 = const llvm::detail::trivial_helper<llvm::PointerIntPair<clang::Module*, 1u, bool> >&]’ /usr/include/c++/4.8.2/type_traits:1094:50: required from ‘constexpr const bool std::__is_assignable_helper<llvm::detail::trivial_helper<llvm::PointerIntPair<clang::Module*, 1u, bool> >&, const llvm::detail::trivial_helper<llvm::PointerIntPair<clang::Module*, 1u, bool> >&>::value’ /usr/include/c++/4.8.2/type_traits:1099:12: required from ‘struct std::is_assignable<llvm::detail::trivial_helper<llvm::PointerIntPair<clang::Module*, 1u, bool> >&, const llvm::detail::trivial_helper<llvm::PointerIntPair<clang::Module*, 1u, bool> >&>’ /usr/include/c++/4.8.2/type_traits:1112:12: required from ‘struct std::__is_copy_assignable_impl<llvm::detail::trivial_helper<llvm::PointerIntPair<clang::Module*, 1u, bool> >, false>’ /usr/include/c++/4.8.2/type_traits:1118:12: required from ‘struct std::is_copy_assignable<llvm::detail::trivial_helper<llvm::PointerIntPair<clang::Module*, 1u, bool> > >’ include/llvm/Support/type_traits.h:142:25: required from ‘constexpr const bool llvm::is_trivially_copyable<llvm::PointerIntPair<clang::Module*, 1u, bool> >::has_trivial_copy_assign’ include/llvm/Support/type_traits.h:163:32: required from ‘constexpr const bool llvm::is_trivially_copyable<llvm::PointerIntPair<clang::Module*, 1u, bool> >::value’ include/llvm/ADT/SmallVector.h:321:7: required from ‘class llvm::SmallVectorImpl<llvm::PointerIntPair<clang::Module*, 1u, bool> >’ include/llvm/ADT/SmallVector.h:845:7: required from ‘class llvm::SmallVector<llvm::PointerIntPair<clang::Module*, 1u, bool>, 2u>’ tools/clang/include/clang/Basic/Module.h:290:30: required from here include/llvm/Support/PointerLikeTypeTraits.h:59:8: error: invalid application of ‘__alignof__’ to incomplete type ‘clang::Module’ enum { NumLowBitsAvailable = detail::ConstantLog2<alignof(T)>::value }; ^ FYI in case you wonder: $ ls -l /usr/include/c++/ total 8 drwxr-xr-x. 12 root root 4096 Dec 11 03:24 4.8.2 lrwxrwxrwx. 1 root root 5 Dec 11 03:24 4.8.5 -> 4.8.2 Are we outside the "allowed" range for GCC versions? Cheers, Axel. On 1/20/19 10:19 PM, Serge Guelton via cfe-commits wrote: > Author: serge_sans_paille > Date: Sun Jan 20 13:19:56 2019 > New Revision: 351701 > > URL: http://llvm.org/viewvc/llvm-project?rev=351701&view=rev > Log: > Replace llvm::isPodLike<...> by llvm::is_trivially_copyable<...> > > As noted in https://bugs.llvm.org/show_bug.cgi?id=36651, the specialization > for > isPodLike<std::pair<...>> did not match the expectation of > std::is_trivially_copyable which makes the memcpy optimization invalid. > > This patch renames the llvm::isPodLike trait into llvm::is_trivially_copyable. > Unfortunately std::is_trivially_copyable is not portable across compiler / STL > versions. So a portable version is provided too. > > Note that the following specialization were invalid: > > std::pair<T0, T1> > llvm::Optional<T> > > Tests have been added to assert that former specialization are respected by > the > standard usage of llvm::is_trivially_copyable, and that when a decent version > of std::is_trivially_copyable is available, llvm::is_trivially_copyable is > compared to std::is_trivially_copyable. > > As of this patch, llvm::Optional is no longer considered trivially copyable, > even if T is. This is to be fixed in a later patch, as it has impact on a > long-running bug (see r347004) > > Note that GCC warns about this UB, but this got silented by > https://reviews.llvm.org/D50296. > > Differential Revision: https://reviews.llvm.org/D54472 > > > Modified: > cfe/trunk/include/clang/AST/BaseSubobject.h > cfe/trunk/include/clang/AST/CharUnits.h > cfe/trunk/include/clang/AST/DeclAccessPair.h > cfe/trunk/include/clang/AST/DeclarationName.h > cfe/trunk/include/clang/AST/ExprObjC.h > cfe/trunk/include/clang/AST/GlobalDecl.h > cfe/trunk/include/clang/AST/Type.h > cfe/trunk/include/clang/Analysis/ProgramPoint.h > cfe/trunk/include/clang/Basic/IdentifierTable.h > cfe/trunk/include/clang/Basic/SourceLocation.h > cfe/trunk/include/clang/Lex/Token.h > cfe/trunk/include/clang/Sema/CodeCompleteConsumer.h > cfe/trunk/include/clang/Sema/Ownership.h > cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h > cfe/trunk/lib/AST/VTableBuilder.cpp > cfe/trunk/lib/Sema/SemaChecking.cpp > cfe/trunk/lib/StaticAnalyzer/Core/RegionStore.cpp > cfe/trunk/test/Analysis/llvm-conventions.cpp > cfe/trunk/tools/libclang/Indexing.cpp > > Modified: cfe/trunk/include/clang/AST/BaseSubobject.h > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/BaseSubobject.h?rev=351701&r1=351700&r2=351701&view=diff > ============================================================================== > --- cfe/trunk/include/clang/AST/BaseSubobject.h (original) > +++ cfe/trunk/include/clang/AST/BaseSubobject.h Sun Jan 20 13:19:56 2019 > @@ -80,11 +80,6 @@ template<> struct DenseMapInfo<clang::Ba > } > }; > > -// It's OK to treat BaseSubobject as a POD type. > -template <> struct isPodLike<clang::BaseSubobject> { > - static const bool value = true; > -}; > - > } // namespace llvm > > #endif // LLVM_CLANG_AST_BASESUBOBJECT_H > > Modified: cfe/trunk/include/clang/AST/CharUnits.h > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/CharUnits.h?rev=351701&r1=351700&r2=351701&view=diff > ============================================================================== > --- cfe/trunk/include/clang/AST/CharUnits.h (original) > +++ cfe/trunk/include/clang/AST/CharUnits.h Sun Jan 20 13:19:56 2019 > @@ -237,10 +237,6 @@ template<> struct DenseMapInfo<clang::Ch > } > }; > > -template <> struct isPodLike<clang::CharUnits> { > - static const bool value = true; > -}; > - > } // end namespace llvm > > #endif // LLVM_CLANG_AST_CHARUNITS_H > > Modified: cfe/trunk/include/clang/AST/DeclAccessPair.h > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclAccessPair.h?rev=351701&r1=351700&r2=351701&view=diff > ============================================================================== > --- cfe/trunk/include/clang/AST/DeclAccessPair.h (original) > +++ cfe/trunk/include/clang/AST/DeclAccessPair.h Sun Jan 20 13:19:56 2019 > @@ -60,12 +60,4 @@ public: > }; > } > > -// Take a moment to tell SmallVector that DeclAccessPair is POD. > -namespace llvm { > -template<typename> struct isPodLike; > -template<> struct isPodLike<clang::DeclAccessPair> { > - static const bool value = true; > -}; > -} > - > #endif > > Modified: cfe/trunk/include/clang/AST/DeclarationName.h > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclarationName.h?rev=351701&r1=351700&r2=351701&view=diff > ============================================================================== > --- cfe/trunk/include/clang/AST/DeclarationName.h (original) > +++ cfe/trunk/include/clang/AST/DeclarationName.h Sun Jan 20 13:19:56 2019 > @@ -861,9 +861,6 @@ struct DenseMapInfo<clang::DeclarationNa > } > }; > > -template <> > -struct isPodLike<clang::DeclarationName> { static const bool value = true; }; > - > } // namespace llvm > > #endif // LLVM_CLANG_AST_DECLARATIONNAME_H > > Modified: cfe/trunk/include/clang/AST/ExprObjC.h > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ExprObjC.h?rev=351701&r1=351700&r2=351701&view=diff > ============================================================================== > --- cfe/trunk/include/clang/AST/ExprObjC.h (original) > +++ cfe/trunk/include/clang/AST/ExprObjC.h Sun Jan 20 13:19:56 2019 > @@ -255,12 +255,6 @@ struct ObjCDictionaryElement { > > } // namespace clang > > -namespace llvm { > - > -template <> struct isPodLike<clang::ObjCDictionaryElement> : std::true_type > {}; > - > -} // namespace llvm > - > namespace clang { > > /// Internal struct for storing Key/value pair. > > Modified: cfe/trunk/include/clang/AST/GlobalDecl.h > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/GlobalDecl.h?rev=351701&r1=351700&r2=351701&view=diff > ============================================================================== > --- cfe/trunk/include/clang/AST/GlobalDecl.h (original) > +++ cfe/trunk/include/clang/AST/GlobalDecl.h Sun Jan 20 13:19:56 2019 > @@ -139,13 +139,6 @@ namespace llvm { > } > }; > > - // GlobalDecl isn't *technically* a POD type. However, its copy > constructor, > - // copy assignment operator, and destructor are all trivial. > - template <> > - struct isPodLike<clang::GlobalDecl> { > - static const bool value = true; > - }; > - > } // namespace llvm > > #endif // LLVM_CLANG_AST_GLOBALDECL_H > > Modified: cfe/trunk/include/clang/AST/Type.h > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Type.h?rev=351701&r1=351700&r2=351701&view=diff > ============================================================================== > --- cfe/trunk/include/clang/AST/Type.h (original) > +++ cfe/trunk/include/clang/AST/Type.h Sun Jan 20 13:19:56 2019 > @@ -94,9 +94,6 @@ namespace llvm { > enum { NumLowBitsAvailable = clang::TypeAlignmentInBits }; > }; > > - template <> > - struct isPodLike<clang::QualType> { static const bool value = true; }; > - > } // namespace llvm > > namespace clang { > > Modified: cfe/trunk/include/clang/Analysis/ProgramPoint.h > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/ProgramPoint.h?rev=351701&r1=351700&r2=351701&view=diff > ============================================================================== > --- cfe/trunk/include/clang/Analysis/ProgramPoint.h (original) > +++ cfe/trunk/include/clang/Analysis/ProgramPoint.h Sun Jan 20 13:19:56 2019 > @@ -777,9 +777,6 @@ static bool isEqual(const clang::Program > > }; > > -template <> > -struct isPodLike<clang::ProgramPoint> { static const bool value = true; }; > - > } // end namespace llvm > > #endif > > Modified: cfe/trunk/include/clang/Basic/IdentifierTable.h > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/IdentifierTable.h?rev=351701&r1=351700&r2=351701&view=diff > ============================================================================== > --- cfe/trunk/include/clang/Basic/IdentifierTable.h (original) > +++ cfe/trunk/include/clang/Basic/IdentifierTable.h Sun Jan 20 13:19:56 2019 > @@ -938,9 +938,6 @@ struct DenseMapInfo<clang::Selector> { > } > }; > > -template <> > -struct isPodLike<clang::Selector> { static const bool value = true; }; > - > template<> > struct PointerLikeTypeTraits<clang::Selector> { > static const void *getAsVoidPointer(clang::Selector P) { > > Modified: cfe/trunk/include/clang/Basic/SourceLocation.h > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/SourceLocation.h?rev=351701&r1=351700&r2=351701&view=diff > ============================================================================== > --- cfe/trunk/include/clang/Basic/SourceLocation.h (original) > +++ cfe/trunk/include/clang/Basic/SourceLocation.h Sun Jan 20 13:19:56 2019 > @@ -25,7 +25,6 @@ > namespace llvm { > > template <typename T> struct DenseMapInfo; > -template <typename T> struct isPodLike; > > } // namespace llvm > > @@ -457,11 +456,6 @@ namespace llvm { > } > }; > > - template <> > - struct isPodLike<clang::SourceLocation> { static const bool value = true; > }; > - template <> > - struct isPodLike<clang::FileID> { static const bool value = true; }; > - > // Teach SmallPtrSet how to handle SourceLocation. > template<> > struct PointerLikeTypeTraits<clang::SourceLocation> { > > Modified: cfe/trunk/include/clang/Lex/Token.h > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/Token.h?rev=351701&r1=351700&r2=351701&view=diff > ============================================================================== > --- cfe/trunk/include/clang/Lex/Token.h (original) > +++ cfe/trunk/include/clang/Lex/Token.h Sun Jan 20 13:19:56 2019 > @@ -328,9 +328,4 @@ struct PPConditionalInfo { > > } // end namespace clang > > -namespace llvm { > - template <> > - struct isPodLike<clang::Token> { static const bool value = true; }; > -} // end namespace llvm > - > #endif // LLVM_CLANG_LEX_TOKEN_H > > Modified: cfe/trunk/include/clang/Sema/CodeCompleteConsumer.h > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/CodeCompleteConsumer.h?rev=351701&r1=351700&r2=351701&view=diff > ============================================================================== > --- cfe/trunk/include/clang/Sema/CodeCompleteConsumer.h (original) > +++ cfe/trunk/include/clang/Sema/CodeCompleteConsumer.h Sun Jan 20 13:19:56 > 2019 > @@ -655,14 +655,6 @@ public: > > } // namespace clang > > -namespace llvm { > - > -template <> struct isPodLike<clang::CodeCompletionString::Chunk> { > - static const bool value = true; > -}; > - > -} // namespace llvm > - > namespace clang { > > /// A builder class used to construct new code-completion strings. > > Modified: cfe/trunk/include/clang/Sema/Ownership.h > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Ownership.h?rev=351701&r1=351700&r2=351701&view=diff > ============================================================================== > --- cfe/trunk/include/clang/Sema/Ownership.h (original) > +++ cfe/trunk/include/clang/Sema/Ownership.h Sun Jan 20 13:19:56 2019 > @@ -128,9 +128,6 @@ namespace llvm { > } > }; > > - template <class T> > - struct isPodLike<clang::OpaquePtr<T>> { static const bool value = true; }; > - > } // namespace llvm > > namespace clang { > > Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h?rev=351701&r1=351700&r2=351701&view=diff > ============================================================================== > --- cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h > (original) > +++ cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h Sun Jan > 20 13:19:56 2019 > @@ -667,13 +667,4 @@ private: > > } // namespace clang > > -namespace llvm { > - > -template <typename T> struct isPodLike; > -template <> struct isPodLike<clang::ento::SVal> { > - static const bool value = true; > -}; > - > -} // namespace llvm > - > #endif // LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_SVALS_H > > Modified: cfe/trunk/lib/AST/VTableBuilder.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/VTableBuilder.cpp?rev=351701&r1=351700&r2=351701&view=diff > ============================================================================== > --- cfe/trunk/lib/AST/VTableBuilder.cpp (original) > +++ cfe/trunk/lib/AST/VTableBuilder.cpp Sun Jan 20 13:19:56 2019 > @@ -846,6 +846,8 @@ private: > : BaseOffset(CharUnits::Zero()), > BaseOffsetInLayoutClass(CharUnits::Zero()), > VTableIndex(0) { } > + > + MethodInfo(MethodInfo const&) = default; > }; > > typedef llvm::DenseMap<const CXXMethodDecl *, MethodInfo> MethodInfoMapTy; > > Modified: cfe/trunk/lib/Sema/SemaChecking.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=351701&r1=351700&r2=351701&view=diff > ============================================================================== > --- cfe/trunk/lib/Sema/SemaChecking.cpp (original) > +++ cfe/trunk/lib/Sema/SemaChecking.cpp Sun Jan 20 13:19:56 2019 > @@ -11662,12 +11662,12 @@ class SequenceChecker : public Evaluated > class Seq { > friend class SequenceTree; > > - unsigned Index = 0; > + unsigned Index; > > explicit Seq(unsigned N) : Index(N) {} > > public: > - Seq() = default; > + Seq() : Index(0) {} > }; > > SequenceTree() { Values.push_back(Value(0)); } > > Modified: cfe/trunk/lib/StaticAnalyzer/Core/RegionStore.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/RegionStore.cpp?rev=351701&r1=351700&r2=351701&view=diff > ============================================================================== > --- cfe/trunk/lib/StaticAnalyzer/Core/RegionStore.cpp (original) > +++ cfe/trunk/lib/StaticAnalyzer/Core/RegionStore.cpp Sun Jan 20 13:19:56 2019 > @@ -130,10 +130,6 @@ namespace llvm { > return os; > } > > - template <typename T> struct isPodLike; > - template <> struct isPodLike<BindingKey> { > - static const bool value = true; > - }; > } // end llvm namespace > > #ifndef NDEBUG > > Modified: cfe/trunk/test/Analysis/llvm-conventions.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/llvm-conventions.cpp?rev=351701&r1=351700&r2=351701&view=diff > ============================================================================== > --- cfe/trunk/test/Analysis/llvm-conventions.cpp (original) > +++ cfe/trunk/test/Analysis/llvm-conventions.cpp Sun Jan 20 13:19:56 2019 > @@ -152,8 +152,6 @@ inline bool operator>(StringRef LHS, Str > inline bool operator>=(StringRef LHS, StringRef RHS); > inline std::string &operator+=(std::string &buffer, StringRef string); > hash_code hash_value(StringRef S); > -template <typename T> struct isPodLike; > -template <> struct isPodLike<StringRef> { static const bool value = true; }; > > } // end of namespace llvm > > > Modified: cfe/trunk/tools/libclang/Indexing.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/Indexing.cpp?rev=351701&r1=351700&r2=351701&view=diff > ============================================================================== > --- cfe/trunk/tools/libclang/Indexing.cpp (original) > +++ cfe/trunk/tools/libclang/Indexing.cpp Sun Jan 20 13:19:56 2019 > @@ -93,9 +93,6 @@ typedef llvm::DenseSet<PPRegion> PPRegio > } // end anonymous namespace > > namespace llvm { > - template <> struct isPodLike<PPRegion> { > - static const bool value = true; > - }; > > template <> > struct DenseMapInfo<PPRegion> { > > > _______________________________________________ > cfe-commits mailing list > cfe-commits@lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits > -- ROOT https://root.cern CERN EP-SFT, 1211 Geneva 23, Switzerland Phone: +41227678225 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits