Re: r374133 - [c++20] Implement most of P1152R4.

2019-10-11 Thread David Zarzycki via cfe-commits
Hi Richard,

This breaks libcxx and libcxxabi my local stage two build bot (Fedora 31 
x86_64). Is this expected? Can we revert this?

FAIL: libc++ :: std/utilities/meta/meta.rel/is_invocable.pass.cpp (55505 of 
58603)
 TEST 'libc++ :: 
std/utilities/meta/meta.rel/is_invocable.pass.cpp' FAILED 
Command: ['/p/tllvm/bin/clang++', '-o', 
'/tmp/_update_lc/t/projects/libcxx/test/std/utilities/meta/meta.rel/Output/is_invocable.pass.cpp.o',
 '-x', 'c++', 
'/home/dave/s/lp/libcxx/test/std/utilities/meta/meta.rel/is_invocable.pass.cpp',
 '-c', '-v', '-ftemplate-depth=270', '-Werror=thread-safety', '-std=c++2a', 
'-include', '/home/dave/s/lp/libcxx/test/support/nasty_macros.h', 
'-nostdinc++', '-I/home/dave/s/lp/libcxx/include', 
'-I/tmp/_update_lc/t/projects/libcxx/include/c++build', 
'-D__STDC_FORMAT_MACROS', '-D__STDC_LIMIT_MACROS', '-D__STDC_CONSTANT_MACROS', 
'-I/home/dave/s/lp/libcxx/test/support', 
'-DLIBCXX_FILESYSTEM_STATIC_TEST_ROOT="/home/dave/s/lp/libcxx/test/std/input.output/filesystems/Inputs/static_test_env"',
 
'-DLIBCXX_FILESYSTEM_DYNAMIC_TEST_ROOT="/tmp/_update_lc/t/projects/libcxx/test/filesystem/Output/dynamic_env"',
 '-DLIBCXX_FILESYSTEM_DYNAMIC_TEST_HELPER="/usr/bin/python 
/home/dave/s/lp/libcxx/test/support/filesystem_dynamic_test_helper.py"', 
'-D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER', '-Wall', '-Wextra', '-Werror', 
'-Wuser-defined-warnings', '-Wshadow', '-Wno-unused-command-line-argument', 
'-Wno-attributes', '-Wno-pessimizing-move', '-Wno-c++11-extensions', 
'-Wno-user-defined-literals', '-Wno-noexcept-type', '-Wsign-compare', 
'-Wunused-variable', '-Wunused-parameter', '-Wunreachable-code', '-c']
Exit Code: 1
Standard Error:
--
clang version 10.0.0 (/home/dave/s/lp/clang 
0746aafd89754a2ae9992c4d6394e3b4f3623b1d)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /p/tllvm/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/9
Selected GCC installation: /usr/lib/gcc/x86_64-redhat-linux/9
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Selected multilib: .;@m64
 "/p/tllvm/bin/clang-10" -cc1 -triple x86_64-unknown-linux-gnu -emit-obj 
-mrelax-all -disable-free -disable-llvm-verifier -discard-value-names 
-main-file-name is_invocable.pass.cpp -mrelocation-model static -mthread-model 
posix -mframe-pointer=all -fmath-errno -masm-verbose -mconstructor-aliases 
-munwind-tables -fuse-init-array -target-cpu x86-64 -dwarf-column-info 
-debugger-tuning=gdb -v -nostdinc++ -resource-dir /p/tllvm/lib64/clang/10.0.0 
-include /home/dave/s/lp/libcxx/test/support/nasty_macros.h -I 
/home/dave/s/lp/libcxx/include -I 
/tmp/_update_lc/t/projects/libcxx/include/c++build -D __STDC_FORMAT_MACROS -D 
__STDC_LIMIT_MACROS -D __STDC_CONSTANT_MACROS -I 
/home/dave/s/lp/libcxx/test/support -D 
"LIBCXX_FILESYSTEM_STATIC_TEST_ROOT=\"/home/dave/s/lp/libcxx/test/std/input.output/filesystems/Inputs/static_test_env\""
 -D 
"LIBCXX_FILESYSTEM_DYNAMIC_TEST_ROOT=\"/tmp/_update_lc/t/projects/libcxx/test/filesystem/Output/dynamic_env\""
 -D "LIBCXX_FILESYSTEM_DYNAMIC_TEST_HELPER=\"/usr/bin/python 
/home/dave/s/lp/libcxx/test/support/filesystem_dynamic_test_helper.py\"" -D 
_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -internal-isystem /usr/local/include 
-internal-isystem /p/tllvm/lib64/clang/10.0.0/include -internal-externc-isystem 
/include -internal-externc-isystem /usr/include -Werror=thread-safety -Wall 
-Wextra -Werror -Wuser-defined-warnings -Wshadow 
-Wno-unused-command-line-argument -Wno-attributes -Wno-pessimizing-move 
-Wno-c++11-extensions -Wno-user-defined-literals -Wno-noexcept-type 
-Wsign-compare -Wunused-variable -Wunused-parameter -Wunreachable-code 
-std=c++2a -fdeprecated-macro -fdebug-compilation-dir 
/tmp/_update_lc/t/projects/libcxx/test/std/utilities/meta/meta.rel 
-ftemplate-depth 270 -ferror-limit 19 -fmessage-length 0 -fno-implicit-modules 
-fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option 
-faddrsig -o 
/tmp/_update_lc/t/projects/libcxx/test/std/utilities/meta/meta.rel/Output/is_invocable.pass.cpp.o
 -x c++ 
/home/dave/s/lp/libcxx/test/std/utilities/meta/meta.rel/is_invocable.pass.cpp
clang -cc1 version 10.0.0 based upon LLVM 10.0.0svn default target 
x86_64-unknown-linux-gnu
ignoring nonexistent directory "/include"
#include "..." search starts here:
#include <...> search starts here:
 /home/dave/s/lp/libcxx/include
 /tmp/_update_lc/t/projects/libcxx/include/c++build
 /home/dave/s/lp/libcxx/test/support
 /usr/local/include
 /p/tllvm/lib64/clang/10.0.0/include
 /usr/include
End of search list.
In file included from 
/home/dave/s/lp/libcxx/test/std/utilities/meta/meta.rel/is_invocable.pass.cpp:21:
/home/dave/s/lp/libcxx/include/type_traits:1123:22: error: volatile-qualified 
return type 'volatile void' is deprecated [-Werror,-Wdeprecated-volatile]
template  _Tp   __declval(long);
 ^
/home/dave/s/lp/libcxx/include/type_traits:3640:31: note: in instantiation of 
template class 'std::__1::_

r374133 - [c++20] Implement most of P1152R4.

2019-10-08 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Tue Oct  8 17:49:40 2019
New Revision: 374133

URL: http://llvm.org/viewvc/llvm-project?rev=374133&view=rev
Log:
[c++20] Implement most of P1152R4.

Diagnose some now-deprecated uses of volatile types:
 * as function parameter types and return types
 * as the type of a structured binding declaration
 * as the type of the lvalue operand of an increment / decrement /
   compound assignment operator

This does not implement a check for the deprecation of simple
assignments whose results are used; that check requires somewhat
more complexity and will be addressed separately.

Modified:
cfe/trunk/include/clang/Basic/DiagnosticGroups.td
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/lib/Sema/SemaType.cpp
cfe/trunk/test/SemaCXX/deprecated.cpp
cfe/trunk/www/cxx_status.html

Modified: cfe/trunk/include/clang/Basic/DiagnosticGroups.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticGroups.td?rev=374133&r1=374132&r2=374133&view=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticGroups.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticGroups.td Tue Oct  8 17:49:40 2019
@@ -140,6 +140,7 @@ def DeprecatedImplementations :DiagGroup
 def DeprecatedIncrementBool : DiagGroup<"deprecated-increment-bool">;
 def DeprecatedRegister : DiagGroup<"deprecated-register">;
 def DeprecatedThisCapture : DiagGroup<"deprecated-this-capture">;
+def DeprecatedVolatile : DiagGroup<"deprecated-volatile">;
 def DeprecatedWritableStr : DiagGroup<"deprecated-writable-strings",
   [CXX11CompatDeprecatedWritableStr]>;
 // FIXME: Why is DeprecatedImplementations not in this group?
@@ -150,6 +151,7 @@ def Deprecated : DiagGroup<"deprecated",
   DeprecatedIncrementBool,
   DeprecatedRegister,
   DeprecatedThisCapture,
+  DeprecatedVolatile,
   DeprecatedWritableStr]>,
  DiagCategory<"Deprecations">;
 

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=374133&r1=374132&r2=374133&view=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Tue Oct  8 17:49:40 
2019
@@ -6650,6 +6650,23 @@ def ext_increment_bool : ExtWarn<
   DefaultError, InGroup;
 def err_increment_decrement_enum : Error<
   "cannot %select{decrement|increment}0 expression of enum type %1">;
+
+def warn_deprecated_increment_decrement_volatile : Warning<
+  "%select{decrement|increment}0 of object of volatile-qualified type %1 "
+  "is deprecated">, InGroup;
+def warn_deprecated_compound_assign_volatile : Warning<
+  "compound assignment to object of volatile-qualified type %0 is deprecated">,
+  InGroup;
+def warn_deprecated_volatile_return : Warning<
+  "volatile-qualified return type %0 is deprecated">,
+  InGroup;
+def warn_deprecated_volatile_param : Warning<
+  "volatile-qualified parameter type %0 is deprecated">,
+  InGroup;
+def warn_deprecated_volatile_structured_binding : Warning<
+  "volatile qualifier in structured binding declaration is deprecated">,
+  InGroup;
+
 def err_catch_incomplete_ptr : Error<
   "cannot catch pointer to incomplete type %0">;
 def err_catch_incomplete_ref : Error<

Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=374133&r1=374132&r2=374133&view=diff
==
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Tue Oct  8 17:49:40 2019
@@ -775,6 +775,13 @@ Sema::ActOnDecompositionDeclarator(Scope
   return nullptr;
   }
 
+  // C++2a [dcl.struct.bind]p1:
+  //   A cv that includes volatile is deprecated
+  if ((DS.getTypeQualifiers() & DeclSpec::TQ_volatile) &&
+  getLangOpts().CPlusPlus2a)
+Diag(DS.getVolatileSpecLoc(),
+ diag::warn_deprecated_volatile_structured_binding);
+
   TypeSourceInfo *TInfo = GetTypeForDeclarator(D, S);
   QualType R = TInfo->getType();
 

Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=374133&r1=374132&r2=374133&view=diff
==
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Tue Oct  8 17:49:40 2019
@@ -11938,6 +11938,21 @@ QualType Sema::CheckAssignmentOperands(E
 
   CheckForNullPointerDer