<html><head></head><body bgcolor="#FFFFFF"><div>Has this issue manifested in some serious way? <br><br>Sent from my iPhone</div><div><br>On Apr 29, 2012, at 12:08 AM, Richard Smith <<a href="mailto:richard@metafoo.co.uk">richard@metafoo.co.uk</a>> wrote:<br><br></div><div><span></span></div><blockquote type="cite"><div>This is probably not as major as it seems -- PODness doesn't affect C++11 language semantics at all (but does affect some parts of the library, notably std::is_pod). I suspect (but haven't checked!) that many of our uses of isPODType really do want the C++98 definition, even in C++11 mode, or shouldn't be checking for POD at all. Even with this change, CXXRecordDecl::isPOD is using the C++98 definition.<div>

<br><div class="gmail_quote">On Sat, Apr 28, 2012 at 3:15 AM, Benjamin Kramer <span dir="ltr"><<a href="mailto:benny.kra@googlemail.com" target="_blank">benny.kra@googlemail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div><br>
On 28.04.2012, at 12:00, Benjamin Kramer wrote:<br>
<br>
> Author: d0k<br>
> Date: Sat Apr 28 05:00:42 2012<br>
> New Revision: 155756<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=155756&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=155756&view=rev</a><br>
> Log:<br>
> Rename isPODType (using the C++98 rules) into isCXX98PODType and make isPODType decide which one to use based on LangOptions.<br>
><br>
> - -Wc++98-compat depends on the c++98 definition<br>
> - Now __is_pod returns the right thing in c++11 and c++98 mode<br>
> - All changes to the type traits test are validated against g++ 4.7<br>
<br>
</div>Doug, can you review/approve this for 3.1? It looks like a pretty major bug.<br>
<br>
- Ben<br>
<div><div><br>
> Modified:<br>
>    cfe/trunk/include/clang/AST/Type.h<br>
>    cfe/trunk/lib/AST/Type.cpp<br>
>    cfe/trunk/lib/Sema/SemaExpr.cpp<br>
>    cfe/trunk/test/SemaCXX/type-traits.cpp<br>
><br>
> Modified: cfe/trunk/include/clang/AST/Type.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Type.h?rev=155756&r1=155755&r2=155756&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Type.h?rev=155756&r1=155755&r2=155756&view=diff</a><br>


> ==============================================================================<br>
> --- cfe/trunk/include/clang/AST/Type.h (original)<br>
> +++ cfe/trunk/include/clang/AST/Type.h Sat Apr 28 05:00:42 2012<br>
> @@ -634,6 +634,11 @@<br>
>   /// \brief Determine whether this is a Plain Old Data (POD) type (C++ 3.9p10).<br>
>   bool isPODType(ASTContext &Context) const;<br>
><br>
> +  /// isCXX98PODType() - Return true if this is a POD type according to the<br>
> +  /// rules of the C++98 standard, regardless of the current compilation's<br>
> +  /// language.<br>
> +  bool isCXX98PODType(ASTContext &Context) const;<br>
> +<br>
>   /// isCXX11PODType() - Return true if this is a POD type according to the<br>
>   /// more relaxed rules of the C++11 standard, regardless of the current<br>
>   /// compilation's language.<br>
><br>
> Modified: cfe/trunk/lib/AST/Type.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Type.cpp?rev=155756&r1=155755&r2=155756&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Type.cpp?rev=155756&r1=155755&r2=155756&view=diff</a><br>


> ==============================================================================<br>
> --- cfe/trunk/lib/AST/Type.cpp (original)<br>
> +++ cfe/trunk/lib/AST/Type.cpp Sat Apr 28 05:00:42 2012<br>
> @@ -895,6 +895,14 @@<br>
> }<br>
><br>
> bool QualType::isPODType(ASTContext &Context) const {<br>
> +  // C++11 has a more relaxed definition of POD.<br>
> +  if (Context.getLangOpts().CPlusPlus0x)<br>
> +    return isCXX11PODType(Context);<br>
> +<br>
> +  return isCXX98PODType(Context);<br>
> +}<br>
> +<br>
> +bool QualType::isCXX98PODType(ASTContext &Context) const {<br>
>   // The compiler shouldn't query this for incomplete types, but the user might.<br>
>   // We return false for that case. Except for incomplete arrays of PODs, which<br>
>   // are PODs according to the standard.<br>
><br>
> Modified: cfe/trunk/lib/Sema/SemaExpr.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=155756&r1=155755&r2=155756&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=155756&r1=155755&r2=155756&view=diff</a><br>


> ==============================================================================<br>
> --- cfe/trunk/lib/Sema/SemaExpr.cpp (original)<br>
> +++ cfe/trunk/lib/Sema/SemaExpr.cpp Sat Apr 28 05:00:42 2012<br>
> @@ -560,7 +560,8 @@<br>
>   // Complain about passing non-POD types through varargs. However, don't<br>
>   // perform this check for incomplete types, which we can get here when we're<br>
>   // in an unevaluated context.<br>
> -  if (!E->getType()->isIncompleteType() && !E->getType().isPODType(Context)) {<br>
> +  if (!E->getType()->isIncompleteType() &&<br>
> +      !E->getType().isCXX98PODType(Context)) {<br>
>     // C++0x [expr.call]p7:<br>
>     //   Passing a potentially-evaluated argument of class type (Clause 9)<br>
>     //   having a non-trivial copy constructor, a non-trivial move constructor,<br>
><br>
> Modified: cfe/trunk/test/SemaCXX/type-traits.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/type-traits.cpp?rev=155756&r1=155755&r2=155756&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/type-traits.cpp?rev=155756&r1=155755&r2=155756&view=diff</a><br>


> ==============================================================================<br>
> --- cfe/trunk/test/SemaCXX/type-traits.cpp (original)<br>
> +++ cfe/trunk/test/SemaCXX/type-traits.cpp Sat Apr 28 05:00:42 2012<br>
> @@ -131,25 +131,25 @@<br>
>   { int arr[T(__is_pod(HasAnonymousUnion))]; }<br>
>   { int arr[T(__is_pod(Vector))]; }<br>
>   { int arr[T(__is_pod(VectorExt))]; }<br>
> +  { int arr[T(__is_pod(Derives))]; }<br>
> +  { int arr[T(__is_pod(DerivesAr))]; }<br>
> +  { int arr[T(__is_pod(DerivesArNB))]; }<br>
> +  { int arr[T(__is_pod(DerivesEmpty))]; }<br>
> +  { int arr[T(__is_pod(HasPriv))]; }<br>
> +  { int arr[T(__is_pod(HasProt))]; }<br>
> +  { int arr[T(__is_pod(DerivesHasPriv))]; }<br>
> +  { int arr[T(__is_pod(DerivesHasProt))]; }<br>
><br>
> -  { int arr[F(__is_pod(Derives))]; }<br>
> -  { int arr[F(__is_pod(DerivesAr))]; }<br>
> -  { int arr[F(__is_pod(DerivesArNB))]; }<br>
> -  { int arr[F(__is_pod(DerivesEmpty))]; }<br>
>   { int arr[F(__is_pod(HasCons))]; }<br>
>   { int arr[F(__is_pod(HasCopyAssign))]; }<br>
>   { int arr[F(__is_pod(HasMoveAssign))]; }<br>
>   { int arr[F(__is_pod(HasDest))]; }<br>
> -  { int arr[F(__is_pod(HasPriv))]; }<br>
> -  { int arr[F(__is_pod(HasProt))]; }<br>
>   { int arr[F(__is_pod(HasRef))]; }<br>
>   { int arr[F(__is_pod(HasVirt))]; }<br>
>   { int arr[F(__is_pod(DerivesHasCons))]; }<br>
>   { int arr[F(__is_pod(DerivesHasCopyAssign))]; }<br>
>   { int arr[F(__is_pod(DerivesHasMoveAssign))]; }<br>
>   { int arr[F(__is_pod(DerivesHasDest))]; }<br>
> -  { int arr[F(__is_pod(DerivesHasPriv))]; }<br>
> -  { int arr[F(__is_pod(DerivesHasProt))]; }<br>
>   { int arr[F(__is_pod(DerivesHasRef))]; }<br>
>   { int arr[F(__is_pod(DerivesHasVirt))]; }<br>
>   { int arr[F(__is_pod(NonPOD))]; }<br>
> @@ -1223,10 +1223,10 @@<br>
>   { int arr[T(__has_trivial_copy(const Int))]; }<br>
>   { int arr[T(__has_trivial_copy(AllDefaulted))]; }<br>
>   { int arr[T(__has_trivial_copy(AllDeleted))]; }<br>
> +  { int arr[T(__has_trivial_copy(DerivesAr))]; }<br>
><br>
>   { int arr[F(__has_trivial_copy(HasCopy))]; }<br>
>   { int arr[F(__has_trivial_copy(HasTemplateCons))]; }<br>
> -  { int arr[F(__has_trivial_copy(DerivesAr))]; }<br>
>   { int arr[F(__has_trivial_copy(VirtAr))]; }<br>
>   { int arr[F(__has_trivial_copy(void))]; }<br>
>   { int arr[F(__has_trivial_copy(cvoid))]; }<br>
> @@ -1250,13 +1250,13 @@<br>
>   { int arr[T(__has_trivial_assign(HasMoveAssign))]; }<br>
>   { int arr[T(__has_trivial_assign(AllDefaulted))]; }<br>
>   { int arr[T(__has_trivial_assign(AllDeleted))]; }<br>
> +  { int arr[T(__has_trivial_assign(DerivesAr))]; }<br>
><br>
>   { int arr[F(__has_trivial_assign(IntRef))]; }<br>
>   { int arr[F(__has_trivial_assign(HasCopyAssign))]; }<br>
>   { int arr[F(__has_trivial_assign(const Int))]; }<br>
>   { int arr[F(__has_trivial_assign(ConstIntAr))]; }<br>
>   { int arr[F(__has_trivial_assign(ConstIntArAr))]; }<br>
> -  { int arr[F(__has_trivial_assign(DerivesAr))]; }<br>
>   { int arr[F(__has_trivial_assign(VirtAr))]; }<br>
>   { int arr[F(__has_trivial_assign(void))]; }<br>
>   { int arr[F(__has_trivial_assign(cvoid))]; }<br>
> @@ -1338,6 +1338,7 @@<br>
>   { int arr[T(__has_nothrow_assign(HasVirtDest))]; }<br>
>   { int arr[T(__has_nothrow_assign(AllPrivate))]; }<br>
>   { int arr[T(__has_nothrow_assign(UsingAssign))]; }<br>
> +  { int arr[T(__has_nothrow_assign(DerivesAr))]; }<br>
><br>
>   { int arr[F(__has_nothrow_assign(IntRef))]; }<br>
>   { int arr[F(__has_nothrow_assign(HasCopyAssign))]; }<br>
> @@ -1345,7 +1346,6 @@<br>
>   { int arr[F(__has_nothrow_assign(const Int))]; }<br>
>   { int arr[F(__has_nothrow_assign(ConstIntAr))]; }<br>
>   { int arr[F(__has_nothrow_assign(ConstIntArAr))]; }<br>
> -  { int arr[F(__has_nothrow_assign(DerivesAr))]; }<br>
>   { int arr[F(__has_nothrow_assign(VirtAr))]; }<br>
>   { int arr[F(__has_nothrow_assign(void))]; }<br>
>   { int arr[F(__has_nothrow_assign(cvoid))]; }<br>
> @@ -1375,10 +1375,10 @@<br>
>   { int arr[T(__has_nothrow_copy(HasVirtDest))]; }<br>
>   { int arr[T(__has_nothrow_copy(HasTemplateCons))]; }<br>
>   { int arr[T(__has_nothrow_copy(AllPrivate))]; }<br>
> +  { int arr[T(__has_nothrow_copy(DerivesAr))]; }<br>
><br>
>   { int arr[F(__has_nothrow_copy(HasCopy))]; }<br>
>   { int arr[F(__has_nothrow_copy(HasMultipleCopy))]; }<br>
> -  { int arr[F(__has_nothrow_copy(DerivesAr))]; }<br>
>   { int arr[F(__has_nothrow_copy(VirtAr))]; }<br>
>   { int arr[F(__has_nothrow_copy(void))]; }<br>
>   { int arr[F(__has_nothrow_copy(cvoid))]; }<br>
><br>
><br>
> _______________________________________________<br>
> cfe-commits mailing list<br>
> <a href="mailto:cfe-commits@cs.uiuc.edu" target="_blank">cfe-commits@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu" target="_blank">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
</div></div></blockquote></div><br>
</div>
</div></blockquote></body></html>