[PATCH] D60934: [clang] adding explicit(bool) from c++2a

Gauthier via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Apr 20 09:20:54 PDT 2019

Tyker marked 2 inline comments as done.
Tyker added inline comments.

Comment at: clang/lib/Sema/DeclSpec.cpp:959
+  // Each decl-specifier shall appear at most once in a complete
+  // decl-specifier-seq, except that long may appear twice.
+  if (hasExplicitSpecifier()) {
Quuxplusone wrote:
> Spelling/grammar/capitalization-of-C++2a.
> Also, it seems to me that you've got a CWG wording issue here: what does N4810 mean by "Each //decl-specifier// shall appear at most once in a complete //decl-specifier-seq//, except that `long` may appear twice"? What is "each" decl-specifier? Is `explicit(true)` a different decl-specifier from `explicit(1+1==2)`? Is `explicit(true)` different from `explicit(false)`?
I agree that it isn't clear. but i assumed that each counts every explicit-specifier as one.

Comment at: clang/test/SemaCXX/explicit.cpp:189
+#if __cplusplus < 201707L
   void testNew()
Quuxplusone wrote:
> Why?
i added a run line with the -std=c++2a flag to ensure no regression in c++2a mode as well as in c++11 mode. the warning that is being tested doesn't appear with this flag. the #if is to prevent the test from failling with the -stdc++2a flag. i don't know if the flag's behavior is intended or not.
[[ https://godbolt.org/z/df_rvX | godbolt example ]]

  rC Clang



More information about the cfe-commits mailing list