[PATCH] D153701: [Clang] Implement P2718R0 "Lifetime extension in range-based for loops"

2023-11-16 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill added a comment.

@yronglin We are sorry it takes so much time to get feedback. Richard and 
Hubert have little bandwidth for reviews. Others, including me, don't feel 
qualified to provide good feedback.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D153701/new/

https://reviews.llvm.org/D153701

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D140828: [C++] Implement "Deducing this" (P0847R7)

2023-10-02 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill added inline comments.



Comment at: clang/docs/ReleaseNotes.rst:94-98
+- Implemented `P0847R7: Deducing this `. Some 
related core issues were also
+  implemented (`CWG2553 `, `CWG2554 
`,
+  `CWG2653 `, `CWG2687 
`).
+  Because the support for this feature is still experimental, the feature test 
macro ``__cpp_explicit_this_parameter``
+  was not set in this version.

aaron.ballman wrote:
> 
Closing words `was not set in this version.` have been lost.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140828/new/

https://reviews.llvm.org/D140828

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D64087: [clang] Correct source locations for instantiations of out-of-line defaulted special member functions. (PR25683)

2023-09-10 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill added a comment.

@tahonermann Do you mind rebasing this on top of trunk if it's necessary?
Might be a good idea to resubmit this as PR.


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D64087/new/

https://reviews.llvm.org/D64087

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D157201: [Clang] Support qualified name as member designator in offsetof

2023-08-20 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill added inline comments.



Comment at: clang/test/SemaCXX/offsetof.cpp:106
+int x3[__builtin_offsetof(struct X2, X2::static_a) == 0 ? 1 : -1]; // 
expected-error{{no member named 'static_a'}}
+int x4[__builtin_offsetof(struct X2, X2::X2) == 0 ? 1 : -1]; // 
expected-error{{no member named 'X2'}}
+

yichi170 wrote:
> cor3ntin wrote:
> > yichi170 wrote:
> > > cor3ntin wrote:
> > > > yichi170 wrote:
> > > > > hubert.reinterpretcast wrote:
> > > > > > aaron.ballman wrote:
> > > > > > > yichi170 wrote:
> > > > > > > > aaron.ballman wrote:
> > > > > > > > > There's one more test I'd like to see:
> > > > > > > > > ```
> > > > > > > > > struct S {
> > > > > > > > >   int Foo;
> > > > > > > > > };
> > > > > > > > > 
> > > > > > > > > template 
> > > > > > > > > void func() {
> > > > > > > > >   static_assert(__builtin_offsetof(Ty, Ty::Foo) == 0, "");
> > > > > > > > > }
> > > > > > > > > 
> > > > > > > > > void inst() {
> > > > > > > > >   func();
> > > > > > > > > }
> > > > > > > > > ```
> > > > > > > > It would get the compile error in the current patch, but I 
> > > > > > > > think it should be compiled without any error, right?
> > > > > > > Correct, that should be accepted: https://godbolt.org/z/1f6a9Yaxa
> > > > > > Should expect this to pass too:
> > > > > > ```
> > > > > > template 
> > > > > > struct Z {
> > > > > >   static_assert(!__builtin_offsetof(T, template Q::x));
> > > > > > };
> > > > > > 
> > > > > > struct A {
> > > > > >   template  using Q = T;
> > > > > >   int x;
> > > > > > };
> > > > > > 
> > > > > > Z za;
> > > > > > ```
> > > > > Wow. Does it mean we cannot simply parse the identifier, `::`, `.` 
> > > > > and brackets in `__builtin_offsetof`?
> > > > GCC seems to support that. 
> > > > 
> > > > We probably want to call `ParseOptionalCXXScopeSpecifier` and store the 
> > > > `NestedNameSpecifierLoc` we'd get from it (and then parse the (sequence 
> > > > of) identifier(s) corresponding to the member) as we do now.
> > > > 
> > > > The documentation of 
> > > > https://gcc.gnu.org/onlinedocs/gcc-13.2.0/gcc/Offsetof.html#index-_005f_005fbuiltin_005foffsetof
> > > >  
> > > > seems inaccurate,
> > > > 
> > > > it seems to be
> > > > 
> > > > `"__builtin_offsetof" "(" typename ","  nested-name-specifier 
> > > > offsetof_member_designator ")"`
> > > > 
> > > > 
> > > > Note that you will have to take care of transforming the nested name in 
> > > > TreeTransform and handle type dependencies. Let me know if you have 
> > > > further questions,
> > > > it's more involved than what you signed for. Sorry for not spotting 
> > > > that earlier (Thanks @hubert.reinterpretcast !)
> > > Thank you for all the help! I'll take a look at it!
> > I was wrong, we need another approach.
> > 
> > I think the grammar is actually
> > ```
> > member-designator:
> >   qualified-id
> >   member-designator.qualified-id
> >   member-designator.qualified-id
> > ```
> > IE, we should support https://godbolt.org/z/eEq8snMc8
> > 
> > Unfortunately, this looks like a much bigger change that we envisioned when 
> > we tagged this as a good first issue, to the extent I'm not sure what is 
> > actually the right design is would be.
> > 
> > For each component I imagine we want to store
> > `NestedNameSpecifierLoc + DeclarationNameInfo`
> > 
> > The parser would have to produce a CXXScopeSpec + UnqualifiedId pair for 
> > each component.
> > 
> > The expression is dependent if any of the component is type dependent,
> > 
> > `OffsetOfNode` would have to change, but i think we can get away
> > Only changing the identifier case (ie the dependent case)  
> > 
> Would it be better for me to close this patch and submit a new one if I find 
> out how to implement it? I hope others won't hesitate to contribute because 
> I'm working on this. I don't want to cause any delays in the release plan!
> Would it be better for me to close this patch and submit a new one if I find 
> out how to implement it?
A possible approach is to follow the example of member reference expression in 
its dot form.

> I hope others won't hesitate to contribute because I'm working on this. I 
> don't want to cause any delays in the release plan!
No worries, 17 release has branched a month ago, so you don't have to feel 
stressed over that.



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D157201/new/

https://reviews.llvm.org/D157201

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D156565: Diagnose use of VLAs in C++ by default

2023-08-11 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill added a comment.

In D156565#4547909 , @aaron.ballman 
wrote:

> In D156565#4543503 , @aaron.ballman 
> wrote:
>
>> In D156565#4543414 , @jrtc27 wrote:
>>
>>> Given GCC defines GNU C++ and regards this as a feature (unless you use 
>>> things like -pedantic to ask for ISO C++), does it make sense to enable 
>>> this for GNU C++?
>>
>> I think GCC should enable -Wvla by default in GNU C++ as well, for the same 
>> reasons I'm proposing it for Clang. I've filed an issue for it at 
>> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110848
>
> The GCC conversation is leaning towards only diagnosing by default in C++ 
> mode but not in GNU++ mode. I'm still trying to persuade them to diagnose in 
> both modes one last time, but if it looks like they're firm about not 
> diagnosing in GNU++ mode, I can live with that (for now). It at least 
> improves our security posture a bit, so it's definitely a win.

I think that we should warn by default in GNU mode regardless of GCC decision. 
As for the porting concern, I think it falls into "comprehensive diagnostics" 
selling point you mentioned earlier, which I totally agree with.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D156565/new/

https://reviews.llvm.org/D156565

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D156247: [Clang] Add a warning on uses of coroutine keywords

2023-07-28 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill added a comment.

In D156247#4541756 , @ilya-biryukov 
wrote:

> @aaron.ballman the internal -cc1 flag
>
> - internal `clang -cc1 -fno-coroutines`.

I'm sorry, but I find this wording misleading. `-cc1 -fno-coroutines` is not 
internal in the same sense as e.g. `-verify` is. Both are hidden from 
user-facing drivers, but unlike `-verify`, potential `-cc1 -fno-coroutines` is 
not just intended, but focused on users outside of monorepo. So I'd say it's 
going to be hidden but user-facing feature, rather than internal one. And the 
one that we should document and test if not for users, then for ourselves to 
make sure we maintain its semantics and don't break users. At this point I'd 
say if we go for it, we should go for proper driver option, rather than 
frontend one.

I also wonder how much complexity this language dialect would introduce while 
interacting with other language dialect flags. Is it really worth it?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D156247/new/

https://reviews.llvm.org/D156247

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D156057: [Clang][Sema] Diagnose indeterminately sequenced accesses

2023-07-24 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill added a comment.

In D156057#4527787 , @rZhBoYao wrote:

> BTW, I am not sure if CWG2571  is implemented by 
> @cor3ntin? If so, can we mark it as done on 
> https://clang.llvm.org/cxx_dr_status.html#2571? This patch handles the 
> warning around it tho.

As a reminder, we don't change `cxx_dr_status.html` directly. Instead, we add a 
special comment in `clang/test/CXX/drs/dr25xx.cpp` (for the case of CWG2571), 
which should be accompanied by test case(s) if possible. You can follow the 
pattern of existing tests. After that `clang/www/make_cxx_dr_status` script 
should be run to update the HTML.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D156057/new/

https://reviews.llvm.org/D156057

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D156057: [Clang][Sema] Diagnose indeterminately sequenced accesses

2023-07-23 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill added a comment.

I'm sorry for hand-waving, but I also remember @aaron.ballman saying that code 
related to `-Wunsequenced` or around it was missing checks for C++17.
I can't say whether you addressed that or not, so just leaving it here for you 
and reviewers.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D156057/new/

https://reviews.llvm.org/D156057

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D156057: [Clang][Sema] Diagnose indeterminately sequenced accesses

2023-07-23 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill added a comment.

Thank you for working on this!




Comment at: clang/test/SemaCXX/warn-unsequenced.cpp:3
 // RUN:-Wunsequenced -Wno-c++17-extensions -Wno-c++14-extensions %s
-// RUN: %clang_cc1 -fsyntax-only -verify=cxx17 -std=c++17 -Wno-unused 
-Wno-uninitialized \
-// RUN:-Wunsequenced -Wno-c++17-extensions -Wno-c++14-extensions %s
+// RUN: %clang_cc1 -fsyntax-only -verify=cxx17 -std=c++23 -Wno-unused 
-Wno-uninitialized \
+// RUN:-Wunsequenced %s

Checking for `cxx17` prefix in C++23 mode is misleading. I suggest to rename is 
to `since-cxx17`, and have a new run line for C++23 mode, leaving check in 
C++17 mode intact.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D156057/new/

https://reviews.llvm.org/D156057

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D151697: [clang] Add test for CWG1710 and related issues

2023-07-11 Thread Vlad Serebrennikov via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG1bbaabb90dd7: [clang] Add test for CWG1710 and related 
issues (authored by Endill).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151697/new/

https://reviews.llvm.org/D151697

Files:
  clang/test/CXX/drs/dr17xx.cpp
  clang/test/CXX/drs/dr18xx.cpp
  clang/test/CXX/drs/dr3xx.cpp
  clang/www/cxx_dr_status.html

Index: clang/www/cxx_dr_status.html
===
--- clang/www/cxx_dr_status.html
+++ clang/www/cxx_dr_status.html
@@ -1923,7 +1923,7 @@
 https://cplusplus.github.io/CWG/issues/314.html";>314
 C++17
 template in base class specifier
-Unknown
+No
   
   
 https://cplusplus.github.io/CWG/issues/315.html";>315
@@ -2097,7 +2097,7 @@
 https://cplusplus.github.io/CWG/issues/343.html";>343
 C++17
 Make template optional in contexts that require a type
-Unknown
+No
   
   
 https://cplusplus.github.io/CWG/issues/344.html";>344
@@ -10067,7 +10067,7 @@
 https://cplusplus.github.io/CWG/issues/1710.html";>1710
 C++17
 Missing template keyword in class-or-decltype
-Unknown
+No
   
   
 https://cplusplus.github.io/CWG/issues/1711.html";>1711
@@ -10571,7 +10571,7 @@
 https://cplusplus.github.io/CWG/issues/1794.html";>1794
 C++17
 template keyword and alias templates
-Unknown
+Yes
   
   
 https://cplusplus.github.io/CWG/issues/1795.html";>1795
@@ -10679,7 +10679,7 @@
 https://cplusplus.github.io/CWG/issues/1812.html";>1812
 C++17
 Omission of template in a typename-specifier
-Unknown
+No
   
   
 https://cplusplus.github.io/CWG/issues/1813.html";>1813
Index: clang/test/CXX/drs/dr3xx.cpp
===
--- clang/test/CXX/drs/dr3xx.cpp
+++ clang/test/CXX/drs/dr3xx.cpp
@@ -208,14 +208,20 @@
 #endif
 }
 
-namespace dr314 { // FIXME 314: dup 1710
-  template struct A {
-template struct B {};
-  };
-  template struct C : public A::template B {
-C() : A::template B() {}
-  };
-}
+namespace dr314 { // dr314: no
+  // NB: dup 1710
+template  struct A {
+  template  struct B {};
+};
+template  struct C : public A::template B {
+  C() : A::template B() {}
+};
+template  struct C2 : public A::B {
+  // expected-error@-1 {{use 'template' keyword to treat 'B' as a dependent template name}}
+  C2() : A::B() {}
+  // expected-error@-1 {{use 'template' keyword to treat 'B' as a dependent template name}}
+};
+} // namespace dr314
 
 // dr315: na
 // dr316: sup 1004
@@ -591,7 +597,7 @@
 
 // dr342: na
 
-namespace dr343 { // FIXME 343: no
+namespace dr343 { // dr343: no
   // FIXME: dup 1710
   template struct A {
 template struct B {};
Index: clang/test/CXX/drs/dr18xx.cpp
===
--- clang/test/CXX/drs/dr18xx.cpp
+++ clang/test/CXX/drs/dr18xx.cpp
@@ -4,12 +4,23 @@
 // RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-unknown %s -verify -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
 // RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-unknown %s -verify -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
 // RUN: %clang_cc1 -std=c++23 -triple x86_64-unknown-unknown %s -verify -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++2c -triple x86_64-unknown-unknown %s -verify -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
 
 #if __cplusplus < 201103L
 // expected-error@+1 {{variadic macro}}
 #define static_assert(...) __extension__ _Static_assert(__VA_ARGS__)
 #endif
 
+namespace dr1812 { // dr1812: no
+   // NB: dup 1710
+#if __cplusplus >= 201103L
+template  struct A {
+  using B = typename T::C;
+  // expected-error@-1 {{use 'template' keyword to treat 'C' as a dependent template name}}
+};
+#endif
+} // namespace dr1812
+
 namespace dr1813 { // dr1813: 7
   struct B { int i; };
   struct C : B {};
Index: clang/test/CXX/drs/dr17xx.cpp
===
--- clang/test/CXX/drs/dr17xx.cpp
+++ clang/test/CXX/drs/dr17xx.cpp
@@ -1,7 +1,22 @@
 // RUN: %clang_cc1 -std=c++98 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
 // RUN: %clang_cc1 -std=c++11 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
 // RUN: %clang_cc1 -std=c++14 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
-// RUN: %clang_cc1 -std=c++1z %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++17 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++20 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++23 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++2c %s -verify -fexceptions -fcxx

[PATCH] D153156: [Clang] CWG1473: do not err on the lack of space after operator""

2023-07-11 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill added inline comments.



Comment at: clang/test/CXX/drs/dr14xx.cpp:491
+  float operator ""_E(const char *);
+  // expected-warning@+1 {{user-defined literal suffixes not starting with '_' 
are reserved; no literal will invoke this operator}}
+  float operator ""E(const char *); // don't err on the lack of spaces even 
when the literal suffix identifier is invalid

Can you move this down, so that offset is negative (after @)?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D153156/new/

https://reviews.llvm.org/D153156

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D152632: [Clang] Add warnings for CWG2521

2023-07-11 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill accepted this revision as: Endill.
Endill added a comment.

DR testing side looks good, but you should wait for more approvals.
Thank you for addressing all the issues there!


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152632/new/

https://reviews.llvm.org/D152632

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D151697: [clang] Add test for CWG1710 and related issues

2023-06-28 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill added a comment.

Thank you for taking a look!
I found a bunch of issues pointing at the same diagnostics, but I'm not sure if 
they track exactly what I test here:
https://github.com/llvm/llvm-project/issues/17775
https://github.com/llvm/llvm-project/issues/36539
https://github.com/llvm/llvm-project/issues/38395
https://github.com/llvm/llvm-project/issues/57019


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151697/new/

https://reviews.llvm.org/D151697

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D151634: [clang] Add test for CWG253

2023-06-25 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill added inline comments.



Comment at: clang/test/CXX/drs/dr0xx.cpp:1022
 
-namespace dr78 { // dr78: sup 
+namespace dr78 { // dr78: no
   // Under DR78, this is valid, because 'k' has static storage duration, so is

shafik wrote:
> Endill wrote:
> > shafik wrote:
> > > shafik wrote:
> > > > This is [issue 1380](https://github.com/cplusplus/papers/issues/1380) 
> > > > and the issue is whether we want static initialization to happen before 
> > > > constant initialization or whether constant initialization excludes 
> > > > zero-init. 
> > > > 
> > > > I think dr77 is now part of [cwg 
> > > > 2536](https://cplusplus.github.io/CWG/issues/2536.html) and we need to 
> > > > wait for the resolution of that in order to know what to do here. 
> > > I was mistaken and completely missed: 
> > > https://eel.is/c++draft/dcl.init#general-8.sentence-2
> > > 
> > > DR 78 is just repeating what we have in: 
> > > https://eel.is/c++draft/basic.start#static
> > > 
> > > The wording has changed a lot since DR 78.
> > Can you please elaborate how does your conclusion affect this patch? 
> > Because I feel a bit lost at this point.
> > Was my initial analysis correct, and we should say that this DR is not 
> > available in Clang?
> No, so this DR was just clarifying that static objects will not have an 
> indeterminate value if they don't have an initializer. So we can consider 
> this NA or you can add a test with a static global w/o an init and show it 
> has zero value.
I'd like to focus on the following points:
1) test case is correct, because we're not supposed to issue a diagnostics for 
static objects without initializers
2) when we stop issuing a diagnostics, we should write a codegen test that 
ensures `k` is initialized with 0
3) this DR is not superseded, so we should mark it as `no`

Do you agree with everything above?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151634/new/

https://reviews.llvm.org/D151634

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D151697: [clang] Add test for CWG1710 and related issues

2023-06-23 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill added a comment.

ping


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151697/new/

https://reviews.llvm.org/D151697

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D152632: [Clang] Add warnings for CWG2521

2023-06-13 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill added a comment.

Thank you for taking care of other tests under `dr25xx.cpp`!

In D152632#4412075 , @rZhBoYao wrote:

> Overhaul for `dr25xx.cpp`.
>
> For each test case, tried to support as many language modes as possible.
> Not sure what those `-triple x86_64-unknown-unknown` are for? I leave them 
> there nonetheless.

They are usually used for codegen tests, so no need to specify the triple if 
you don't need to.

> `-Wdeprecated-literal-operator` is under `-Wdeprecated` which is not under 
> `-Wpedantic` so is not triggered by `-pedantic-errors`. Does this need 
> change? I imagine it would be pretty disruptive.  On the other hand, pedantic 
> users might care about deprecation 🤔️.

I don't think we need to change status quo. In general I don't expect 
diagnostics grouping to care about DR tests, and I don't think it should.




Comment at: clang/test/CXX/drs/dr25xx.cpp:71
+// expected-warning@+2 {{identifier '_π___' preceded by space(s) in the 
literal operator declaration is deprecated}}
+// expected-warning@+1 {{user-defined literal suffixes containing '__' or not 
starting with '_' are reserved}}
+long double operator""  _\u03C0___(long double);

Is it possible to put expected directive after the code, like we do in majority 
of existing tests? This means using only negative line offsets after `@`


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152632/new/

https://reviews.llvm.org/D152632

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D152632: [Clang] Add warnings for CWG2521

2023-06-11 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill added inline comments.



Comment at: clang/test/CXX/drs/dr25xx.cpp:2
+// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-unknown %s -verify 
-Wdeprecated-literal-operator
+// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-unknown %s -verify 
-Wdeprecated
 

We avoid passing compiler options here, because it affects all the tests in the 
file. If you need to enable or disable a specific diagnostic, better wrap your 
test with
```
#pragma clang diagnostic push
#pragma clang diagnostic warning "-Wdeprecated-literal-operation" // or 
"ignored" instead of "warning"
// ...
#pragma clang diagnostic pop
```

That said, files containing newer DRs are not too well maintained at the moment 
(but I'll get to them at some point). This file in particular lacks RUN lines 
for all missing language modes, and `-pedantic-errors`. I guess the latter 
enables diagnostics that are needed for your test. You can use `dr5xx.cpp` as 
an example.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152632/new/

https://reviews.llvm.org/D152632

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D152632: [Clang] Add warnings for CWG2521

2023-06-10 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill requested changes to this revision.
Endill added a comment.
This revision now requires changes to proceed.

Thank you for working on this!

In D152632#4411587 , @rZhBoYao wrote:

> Few questions:
> I think this applies to all the language modes?

Yes, we rarely limit the scope of DRs, and I'm looking forward to get rid of 
exceptions from this approach (grep "since" in cxx_dr_status.html 
).

> Somehow, https://wg21.link/CWG2521 is not redirecting to 
> https://cplusplus.github.io/CWG/issues/2521.html. Is this normal?

It happens, especially with recently updated DRs. I see it in CWG index 
, so you can 
ignore broken wg21.link.




Comment at: clang/www/cxx_dr_status.html:14936
 User-defined literals and reserved identifiers
-Unknown
+Clang 17
   

This file shouldn't be edited manually. You should write a test in 
`clang/test/CXX/drs/dr25xx.cpp`, and then run `clang/www/make_cxx_dr_status` 
script that updates `cxx_dr_status.html`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152632/new/

https://reviews.llvm.org/D152632

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D151094: [clang] Implement P2564 "consteval must propagate up"

2023-06-06 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill added inline comments.



Comment at: clang/test/SemaCXX/cxx2b-consteval-propagate.cpp:8
+
+namespace examples {
+

aaron.ballman wrote:
> cor3ntin wrote:
> > aaron.ballman wrote:
> > > Fznamznon wrote:
> > > > cor3ntin wrote:
> > > > > Fznamznon wrote:
> > > > > > These examples exactly match the ones provided by P2564R3, should 
> > > > > > they be in a separate test in `CXX` directory then?
> > > > > I don't have a string preference, should we move the paper examples? 
> > > > > the whole file?
> > > > I meant the paper examples. I don't have a strong preference too, so in 
> > > > case it doesn't matter where the test actually is, please ignore this 
> > > > comment.
> > > Because it's voted in as a DR, we should have a test in 
> > > `clang/test/CXX/drs/` with the appropriate DR number markings (and then 
> > > regenerate the DR status page as well).
> > I'm not sure core makes dr numbers for papers
> Yeah, I think you're right...  I can't find a DR number for this either. 
> @Endill -- something to be aware of for DR conformance testing, I guess.
Thank you for letting me know!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151094/new/

https://reviews.llvm.org/D151094

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D151634: [clang] Add test for CWG253

2023-06-02 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill added inline comments.



Comment at: clang/test/CXX/drs/dr0xx.cpp:1022
 
-namespace dr78 { // dr78: sup 
+namespace dr78 { // dr78: no
   // Under DR78, this is valid, because 'k' has static storage duration, so is

shafik wrote:
> shafik wrote:
> > This is [issue 1380](https://github.com/cplusplus/papers/issues/1380) and 
> > the issue is whether we want static initialization to happen before 
> > constant initialization or whether constant initialization excludes 
> > zero-init. 
> > 
> > I think dr77 is now part of [cwg 
> > 2536](https://cplusplus.github.io/CWG/issues/2536.html) and we need to wait 
> > for the resolution of that in order to know what to do here. 
> I was mistaken and completely missed: 
> https://eel.is/c++draft/dcl.init#general-8.sentence-2
> 
> DR 78 is just repeating what we have in: 
> https://eel.is/c++draft/basic.start#static
> 
> The wording has changed a lot since DR 78.
Can you please elaborate how does your conclusion affect this patch? Because I 
feel a bit lost at this point.
Was my initial analysis correct, and we should say that this DR is not 
available in Clang?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151634/new/

https://reviews.llvm.org/D151634

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D151634: [clang] Add test for CWG253

2023-06-02 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill updated this revision to Diff 527804.
Endill edited the summary of this revision.
Endill added a comment.

Mark CWG78 as superseded by 2536
Expand CWG253 test

@shafik I think rather than leave 78 out, we better mark it as superseded, so 
that we don't forget about it.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151634/new/

https://reviews.llvm.org/D151634

Files:
  clang/test/CXX/drs/dr0xx.cpp
  clang/test/CXX/drs/dr2xx.cpp
  clang/www/cxx_dr_status.html


Index: clang/www/cxx_dr_status.html
===
--- clang/www/cxx_dr_status.html
+++ clang/www/cxx_dr_status.html
@@ -505,7 +505,7 @@
 https://cplusplus.github.io/CWG/issues/78.html";>78
 CD1
 Section 8.5 paragraph 9 should state it only applies to non-static 
objects
-Superseded by 
+Superseded by 2536
   
   
 https://cplusplus.github.io/CWG/issues/79.html";>79
@@ -1556,7 +1556,7 @@
 https://cplusplus.github.io/CWG/issues/253.html";>253
 C++17
 Why must empty or fully-initialized const objects be initialized?
-Unknown
+Clang 3.9
   
   
 https://cplusplus.github.io/CWG/issues/254.html";>254
@@ -3021,7 +3021,7 @@
 https://cplusplus.github.io/CWG/issues/497.html";>497
 CD1
 Missing required initialization in example
-Superseded by 253
+Superseded by 253
   
   
 https://cplusplus.github.io/CWG/issues/498.html";>498
Index: clang/test/CXX/drs/dr2xx.cpp
===
--- clang/test/CXX/drs/dr2xx.cpp
+++ clang/test/CXX/drs/dr2xx.cpp
@@ -4,6 +4,7 @@
 // RUN: %clang_cc1 -std=c++17 %s -verify -fexceptions -fcxx-exceptions 
-pedantic-errors
 // RUN: %clang_cc1 -std=c++20 %s -verify -fexceptions -fcxx-exceptions 
-pedantic-errors
 // RUN: %clang_cc1 -std=c++23 %s -verify -fexceptions -fcxx-exceptions 
-pedantic-errors
+// RUN: %clang_cc1 -std=c++2b %s -verify -fexceptions -fcxx-exceptions 
-pedantic-errors
 
 // PR13819 -- __SIZE_TYPE__ is incompatible.
 typedef __SIZE_TYPE__ size_t; // expected-error 0-1 {{extension}}
@@ -682,6 +683,24 @@
   G::~G() {}
 }
 
+namespace dr253 { // dr253: 3.9
+struct X {};
+struct Y {
+  X x;
+};
+
+struct Z {
+  operator int() const { return 0; }
+};
+
+void f() {
+  const X x1;
+  const X x2 = { };
+  const Z z1;  
+  const Z z2 = { };
+}
+} // namespace dr253
+
 namespace dr254 { // dr254: yes
   template struct A {
 typedef typename T::type type; // ok even if this is a typedef-name, 
because
Index: clang/test/CXX/drs/dr0xx.cpp
===
--- clang/test/CXX/drs/dr0xx.cpp
+++ clang/test/CXX/drs/dr0xx.cpp
@@ -4,6 +4,7 @@
 // RUN: %clang_cc1 -std=c++17 %s -verify -fexceptions -fcxx-exceptions 
-pedantic-errors -triple %itanium_abi_triple
 // RUN: %clang_cc1 -std=c++20 %s -verify -fexceptions -fcxx-exceptions 
-pedantic-errors -triple %itanium_abi_triple
 // RUN: %clang_cc1 -std=c++23 %s -verify -fexceptions -fcxx-exceptions 
-pedantic-errors -triple %itanium_abi_triple
+// RUN: %clang_cc1 -std=c++2c %s -verify -fexceptions -fcxx-exceptions 
-pedantic-errors -triple %itanium_abi_triple
 
 namespace dr1 { // dr1: no
   namespace X { extern "C" void dr1_f(int a = 1); }
@@ -1018,7 +1019,7 @@
   };
 }
 
-namespace dr78 { // dr78: sup 
+namespace dr78 { // dr78: sup 2536
   // Under DR78, this is valid, because 'k' has static storage duration, so is
   // zero-initialized.
   const int k; // expected-error {{default initialization of an object of 
const}}


Index: clang/www/cxx_dr_status.html
===
--- clang/www/cxx_dr_status.html
+++ clang/www/cxx_dr_status.html
@@ -505,7 +505,7 @@
 https://cplusplus.github.io/CWG/issues/78.html";>78
 CD1
 Section 8.5 paragraph 9 should state it only applies to non-static objects
-Superseded by 
+Superseded by 2536
   
   
 https://cplusplus.github.io/CWG/issues/79.html";>79
@@ -1556,7 +1556,7 @@
 https://cplusplus.github.io/CWG/issues/253.html";>253
 C++17
 Why must empty or fully-initialized const objects be initialized?
-Unknown
+Clang 3.9
   
   
 https://cplusplus.github.io/CWG/issues/254.html";>254
@@ -3021,7 +3021,7 @@
 https://cplusplus.github.io/CWG/issues/497.html";>497
 CD1
 Missing required initialization in example
-Superseded by 253
+Superseded by 253
   
   
 https://cplusplus.github.io/CWG/issues/498.html";>498
Index: clang/test/CXX/drs/dr2xx.cpp
===
--- clang/test/CXX/drs/dr2xx.cpp
+++ clang/test/CXX/drs/dr2xx.cpp
@@ -4,6 +4,7 @@
 // RUN: %clang_cc1 -std=c++17 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
 // RUN: %clang_cc1 -std=c++20 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
 // RUN: %clang_cc1 -std=c++23 %s -verify -fexceptions -fcxx-exceptions -pe

[PATCH] D151634: [clang] Add test for CWG253

2023-05-31 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill added a comment.

@shafik Thank you for letting me know! Now I wonder if it was possible to 
realize by myself without prior knowledge of CWG 2536, because I feel like some 
cross-references are missing.
Can we proceed if I strip CWG 78 out, leaving only CWG 253?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151634/new/

https://reviews.llvm.org/D151634

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D151704: [clang] Add test for CWG873

2023-05-31 Thread Vlad Serebrennikov via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG238f15820e71: [clang] Add test for CWG873 (authored by 
Endill).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151704/new/

https://reviews.llvm.org/D151704

Files:
  clang/test/CXX/drs/dr6xx.cpp
  clang/test/CXX/drs/dr8xx.cpp
  clang/www/cxx_dr_status.html


Index: clang/www/cxx_dr_status.html
===
--- clang/www/cxx_dr_status.html
+++ clang/www/cxx_dr_status.html
@@ -3767,7 +3767,7 @@
 https://cplusplus.github.io/CWG/issues/621.html";>621
 C++11
 Template argument deduction from function return types
-Unknown
+Yes
   
   
 https://cplusplus.github.io/CWG/issues/622.html";>622
@@ -5117,7 +5117,7 @@
 https://cplusplus.github.io/CWG/issues/873.html";>873
 C++11
 Deducing rvalue references in declarative contexts
-Unknown
+Yes
   
   
 https://cplusplus.github.io/CWG/issues/874.html";>874
Index: clang/test/CXX/drs/dr8xx.cpp
===
--- /dev/null
+++ clang/test/CXX/drs/dr8xx.cpp
@@ -0,0 +1,30 @@
+// RUN: %clang_cc1 -std=c++98 -triple x86_64-unknown-unknown %s -verify 
-fexceptions -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-unknown %s -verify 
-fexceptions -fcxx-exceptions -pedantic-errors 2>&1 | FileCheck %s
+// RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown %s -verify 
-fexceptions -fcxx-exceptions -pedantic-errors 2>&1 | FileCheck %s
+// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-unknown %s -verify 
-fexceptions -fcxx-exceptions -pedantic-errors 2>&1 | FileCheck %s
+// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-unknown %s -verify 
-fexceptions -fcxx-exceptions -pedantic-errors 2>&1 | FileCheck %s
+// RUN: %clang_cc1 -std=c++23 -triple x86_64-unknown-unknown %s -verify 
-fexceptions -fcxx-exceptions -pedantic-errors 2>&1 | FileCheck %s
+// RUN: %clang_cc1 -std=c++2c -triple x86_64-unknown-unknown %s -verify 
-fexceptions -fcxx-exceptions -pedantic-errors 2>&1 | FileCheck %s
+
+// expected-no-diagnostics
+
+namespace dr873 { // dr873: yes
+#if __cplusplus >= 201103L
+template  void f(T &&);
+template <> void f(int &) {}  // #1
+template <> void f(int &&) {} // #2
+void g(int i) {
+  f(i); // calls f(int&), i.e., #1
+#pragma clang __debug dump f(i)
+  //  CHECK: CallExpr {{.*}}
+  // CHECK-NEXT: |-ImplicitCastExpr {{.*}}
+  // CHECK-NEXT: | `-DeclRefExpr {{.*}} 'f' 'void (int &)' {{.*}}
+
+  f(0); // calls f(int&&), i.e., #2
+#pragma clang __debug dump f(0)
+  //  CHECK: CallExpr {{.*}}
+  // CHECK-NEXT: |-ImplicitCastExpr {{.*}}
+  // CHECK-NEXT: | `-DeclRefExpr {{.*}} 'f' 'void (int &&)' {{.*}}
+}
+#endif
+} // namespace dr873
Index: clang/test/CXX/drs/dr6xx.cpp
===
--- clang/test/CXX/drs/dr6xx.cpp
+++ clang/test/CXX/drs/dr6xx.cpp
@@ -234,7 +234,7 @@
 
 // dr620: dup 568
 
-namespace dr621 {
+namespace dr621 { // dr621: yes
   template T f();
   template<> int f() {} // expected-note {{previous}}
   template<> int f() {} // expected-error {{redefinition}}


Index: clang/www/cxx_dr_status.html
===
--- clang/www/cxx_dr_status.html
+++ clang/www/cxx_dr_status.html
@@ -3767,7 +3767,7 @@
 https://cplusplus.github.io/CWG/issues/621.html";>621
 C++11
 Template argument deduction from function return types
-Unknown
+Yes
   
   
 https://cplusplus.github.io/CWG/issues/622.html";>622
@@ -5117,7 +5117,7 @@
 https://cplusplus.github.io/CWG/issues/873.html";>873
 C++11
 Deducing rvalue references in declarative contexts
-Unknown
+Yes
   
   
 https://cplusplus.github.io/CWG/issues/874.html";>874
Index: clang/test/CXX/drs/dr8xx.cpp
===
--- /dev/null
+++ clang/test/CXX/drs/dr8xx.cpp
@@ -0,0 +1,30 @@
+// RUN: %clang_cc1 -std=c++98 -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors 2>&1 | FileCheck %s
+// RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors 2>&1 | FileCheck %s
+// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors 2>&1 | FileCheck %s
+// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors 2>&1 | FileCheck %s
+// RUN: %clang_cc1 -std=c++23 -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors 2>&1 | FileCheck %s
+// RUN: %clang_cc1 -std=c++2c -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -

[PATCH] D151704: [clang] Add test for CWG873

2023-05-30 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill created this revision.
Endill added reviewers: clang-language-wg, shafik, erichkeane.
Herald added a project: All.
Endill requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Also add missing marking to the test of related issue 621.

https://cplusplus.github.io/CWG/issues/621.html
https://cplusplus.github.io/CWG/issues/873.html


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D151704

Files:
  clang/test/CXX/drs/dr6xx.cpp
  clang/test/CXX/drs/dr8xx.cpp
  clang/www/cxx_dr_status.html


Index: clang/www/cxx_dr_status.html
===
--- clang/www/cxx_dr_status.html
+++ clang/www/cxx_dr_status.html
@@ -3767,7 +3767,7 @@
 https://cplusplus.github.io/CWG/issues/621.html";>621
 C++11
 Template argument deduction from function return types
-Unknown
+Yes
   
   
 https://cplusplus.github.io/CWG/issues/622.html";>622
@@ -5117,7 +5117,7 @@
 https://cplusplus.github.io/CWG/issues/873.html";>873
 C++11
 Deducing rvalue references in declarative contexts
-Unknown
+Yes
   
   
 https://cplusplus.github.io/CWG/issues/874.html";>874
Index: clang/test/CXX/drs/dr8xx.cpp
===
--- /dev/null
+++ clang/test/CXX/drs/dr8xx.cpp
@@ -0,0 +1,30 @@
+// RUN: %clang_cc1 -std=c++98 -triple x86_64-unknown-unknown %s -verify 
-fexceptions -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-unknown %s -verify 
-fexceptions -fcxx-exceptions -pedantic-errors 2>&1 | FileCheck %s
+// RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown %s -verify 
-fexceptions -fcxx-exceptions -pedantic-errors 2>&1 | FileCheck %s
+// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-unknown %s -verify 
-fexceptions -fcxx-exceptions -pedantic-errors 2>&1 | FileCheck %s
+// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-unknown %s -verify 
-fexceptions -fcxx-exceptions -pedantic-errors 2>&1 | FileCheck %s
+// RUN: %clang_cc1 -std=c++23 -triple x86_64-unknown-unknown %s -verify 
-fexceptions -fcxx-exceptions -pedantic-errors 2>&1 | FileCheck %s
+// RUN: %clang_cc1 -std=c++2c -triple x86_64-unknown-unknown %s -verify 
-fexceptions -fcxx-exceptions -pedantic-errors 2>&1 | FileCheck %s
+
+// expected-no-diagnostics
+
+namespace dr873 { // dr873: yes
+#if __cplusplus >= 201103L
+template  void f(T &&);
+template <> void f(int &) {}  // #1
+template <> void f(int &&) {} // #2
+void g(int i) {
+  f(i); // calls f(int&), i.e., #1
+#pragma clang __debug dump f(i)
+  //  CHECK: CallExpr {{.*}}
+  // CHECK-NEXT: |-ImplicitCastExpr {{.*}}
+  // CHECK-NEXT: | `-DeclRefExpr {{.*}} 'f' 'void (int &)' {{.*}}
+
+  f(0); // calls f(int&&), i.e., #2
+#pragma clang __debug dump f(0)
+  //  CHECK: CallExpr {{.*}}
+  // CHECK-NEXT: |-ImplicitCastExpr {{.*}}
+  // CHECK-NEXT: | `-DeclRefExpr {{.*}} 'f' 'void (int &&)' {{.*}}
+}
+#endif
+} // namespace dr873
Index: clang/test/CXX/drs/dr6xx.cpp
===
--- clang/test/CXX/drs/dr6xx.cpp
+++ clang/test/CXX/drs/dr6xx.cpp
@@ -234,7 +234,7 @@
 
 // dr620: dup 568
 
-namespace dr621 {
+namespace dr621 { // dr621: yes
   template T f();
   template<> int f() {} // expected-note {{previous}}
   template<> int f() {} // expected-error {{redefinition}}


Index: clang/www/cxx_dr_status.html
===
--- clang/www/cxx_dr_status.html
+++ clang/www/cxx_dr_status.html
@@ -3767,7 +3767,7 @@
 https://cplusplus.github.io/CWG/issues/621.html";>621
 C++11
 Template argument deduction from function return types
-Unknown
+Yes
   
   
 https://cplusplus.github.io/CWG/issues/622.html";>622
@@ -5117,7 +5117,7 @@
 https://cplusplus.github.io/CWG/issues/873.html";>873
 C++11
 Deducing rvalue references in declarative contexts
-Unknown
+Yes
   
   
 https://cplusplus.github.io/CWG/issues/874.html";>874
Index: clang/test/CXX/drs/dr8xx.cpp
===
--- /dev/null
+++ clang/test/CXX/drs/dr8xx.cpp
@@ -0,0 +1,30 @@
+// RUN: %clang_cc1 -std=c++98 -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors 2>&1 | FileCheck %s
+// RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors 2>&1 | FileCheck %s
+// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors 2>&1 | FileCheck %s
+// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors 2>&1 | FileCheck %s
+// RUN: %clang_cc1 -std=c++23 -triple x86_64-unknown-unknown %s -verify -fe

[PATCH] D151034: [clang] Add test for CWG1397

2023-05-30 Thread Vlad Serebrennikov via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG9c561e8f3c2e: [clang] Add test for CWG1397 (authored by 
Endill).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151034/new/

https://reviews.llvm.org/D151034

Files:
  clang/test/CXX/drs/dr13xx.cpp
  clang/www/cxx_dr_status.html


Index: clang/www/cxx_dr_status.html
===
--- clang/www/cxx_dr_status.html
+++ clang/www/cxx_dr_status.html
@@ -8189,7 +8189,7 @@
 https://cplusplus.github.io/CWG/issues/1397.html";>1397
 CD4
 Class completeness in non-static data member initializers
-Unknown
+Clang 3.2
   
   
 https://cplusplus.github.io/CWG/issues/1398.html";>1398
Index: clang/test/CXX/drs/dr13xx.cpp
===
--- clang/test/CXX/drs/dr13xx.cpp
+++ clang/test/CXX/drs/dr13xx.cpp
@@ -480,6 +480,23 @@
 #endif
 }
 
+namespace dr1397 { // dr1397: 3.2
+#if __cplusplus >= 201103L
+struct A {   // #dr1397-struct-A
+  void *p = A{}; // #dr1397-void-p
+#if __cplusplus == 201103L
+  // expected-error@#dr1397-struct-A {{default member initializer for 'p' 
needed within definition of enclosing class 'A' outside of member functions}}
+  // expected-note@#dr1397-void-p {{in evaluation of exception specification 
for 'dr1397::A::A' needed here}}
+  // expected-note@#dr1397-void-p {{default member initializer declared here}}
+#elif __cplusplus >= 201402L
+  // expected-error@#dr1397-void-p {{default member initializer for 'p' needed 
within definition of enclosing class 'A' outside of member functions}}
+  // expected-note@#dr1397-void-p {{default member initializer declared here}}
+#endif
+  operator void*() const { return nullptr; }
+};
+#endif
+} // namespace dr1397
+
 namespace dr1399 { // dr1399: dup 1388
   template void f(T..., int, T...) {} // expected-note 
{{candidate}} expected-error 0-1{{C++11}}
   void g() {


Index: clang/www/cxx_dr_status.html
===
--- clang/www/cxx_dr_status.html
+++ clang/www/cxx_dr_status.html
@@ -8189,7 +8189,7 @@
 https://cplusplus.github.io/CWG/issues/1397.html";>1397
 CD4
 Class completeness in non-static data member initializers
-Unknown
+Clang 3.2
   
   
 https://cplusplus.github.io/CWG/issues/1398.html";>1398
Index: clang/test/CXX/drs/dr13xx.cpp
===
--- clang/test/CXX/drs/dr13xx.cpp
+++ clang/test/CXX/drs/dr13xx.cpp
@@ -480,6 +480,23 @@
 #endif
 }
 
+namespace dr1397 { // dr1397: 3.2
+#if __cplusplus >= 201103L
+struct A {   // #dr1397-struct-A
+  void *p = A{}; // #dr1397-void-p
+#if __cplusplus == 201103L
+  // expected-error@#dr1397-struct-A {{default member initializer for 'p' needed within definition of enclosing class 'A' outside of member functions}}
+  // expected-note@#dr1397-void-p {{in evaluation of exception specification for 'dr1397::A::A' needed here}}
+  // expected-note@#dr1397-void-p {{default member initializer declared here}}
+#elif __cplusplus >= 201402L
+  // expected-error@#dr1397-void-p {{default member initializer for 'p' needed within definition of enclosing class 'A' outside of member functions}}
+  // expected-note@#dr1397-void-p {{default member initializer declared here}}
+#endif
+  operator void*() const { return nullptr; }
+};
+#endif
+} // namespace dr1397
+
 namespace dr1399 { // dr1399: dup 1388
   template void f(T..., int, T...) {} // expected-note {{candidate}} expected-error 0-1{{C++11}}
   void g() {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D151697: [clang] Add test for CWG1710 and related issues

2023-05-30 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill created this revision.
Endill added reviewers: clang-language-wg, shafik.
Herald added a project: All.
Endill requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Those issues focus on `template` keyword being optional in certain type-only 
contexts (base specifiers, member initializers, typename specifiers), as 
opposed to be disallowed by the grammar, or required by some implementations. 
GCC accepts all the tests this patch touches since 10, others fail on various 
tests: https://godbolt.org/z/1M6KE3W1a

It should be noted that the wording in 1710 
 that resolves those issues 
has been substantially changed by P1787 . I can't find 
the post-P1787 wording that covers those issues, but I can't find the intent of 
changing relevant behavior in P1787  either, so 
I assume that intent of the 1710 resolution is preserved somewhere.

This patch covers the following issues:
CWG314 
CWG343 
CWG1710 
CWG1794 
CWG1812 


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D151697

Files:
  clang/test/CXX/drs/dr17xx.cpp
  clang/test/CXX/drs/dr18xx.cpp
  clang/test/CXX/drs/dr3xx.cpp
  clang/www/cxx_dr_status.html

Index: clang/www/cxx_dr_status.html
===
--- clang/www/cxx_dr_status.html
+++ clang/www/cxx_dr_status.html
@@ -1923,7 +1923,7 @@
 https://cplusplus.github.io/CWG/issues/314.html";>314
 C++17
 template in base class specifier
-Unknown
+No
   
   
 https://cplusplus.github.io/CWG/issues/315.html";>315
@@ -2097,7 +2097,7 @@
 https://cplusplus.github.io/CWG/issues/343.html";>343
 C++17
 Make template optional in contexts that require a type
-Unknown
+No
   
   
 https://cplusplus.github.io/CWG/issues/344.html";>344
@@ -10067,7 +10067,7 @@
 https://cplusplus.github.io/CWG/issues/1710.html";>1710
 C++17
 Missing template keyword in class-or-decltype
-Unknown
+No
   
   
 https://cplusplus.github.io/CWG/issues/1711.html";>1711
@@ -10571,7 +10571,7 @@
 https://cplusplus.github.io/CWG/issues/1794.html";>1794
 C++17
 template keyword and alias templates
-Unknown
+Yes
   
   
 https://cplusplus.github.io/CWG/issues/1795.html";>1795
@@ -10679,7 +10679,7 @@
 https://cplusplus.github.io/CWG/issues/1812.html";>1812
 C++17
 Omission of template in a typename-specifier
-Unknown
+No
   
   
 https://cplusplus.github.io/CWG/issues/1813.html";>1813
Index: clang/test/CXX/drs/dr3xx.cpp
===
--- clang/test/CXX/drs/dr3xx.cpp
+++ clang/test/CXX/drs/dr3xx.cpp
@@ -208,14 +208,20 @@
 #endif
 }
 
-namespace dr314 { // FIXME 314: dup 1710
-  template struct A {
-template struct B {};
-  };
-  template struct C : public A::template B {
-C() : A::template B() {}
-  };
-}
+namespace dr314 { // dr314: no
+  // NB: dup 1710
+template  struct A {
+  template  struct B {};
+};
+template  struct C : public A::template B {
+  C() : A::template B() {}
+};
+template  struct C2 : public A::B {
+  // expected-error@-1 {{use 'template' keyword to treat 'B' as a dependent template name}}
+  C2() : A::B() {}
+  // expected-error@-1 {{use 'template' keyword to treat 'B' as a dependent template name}}
+};
+} // namespace dr314
 
 // dr315: na
 // dr316: sup 1004
@@ -591,7 +597,7 @@
 
 // dr342: na
 
-namespace dr343 { // FIXME 343: no
+namespace dr343 { // dr343: no
   // FIXME: dup 1710
   template struct A {
 template struct B {};
Index: clang/test/CXX/drs/dr18xx.cpp
===
--- clang/test/CXX/drs/dr18xx.cpp
+++ clang/test/CXX/drs/dr18xx.cpp
@@ -4,12 +4,23 @@
 // RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-unknown %s -verify -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
 // RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-unknown %s -verify -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
 // RUN: %clang_cc1 -std=c++23 -triple x86_64-unknown-unknown %s -verify -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++2c -triple x86_64-unknown-unknown %s -verify -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
 
 #if __cplusplus < 201103L
 // expected-error@+1 {{variadic macro}}
 #define static_assert(...) __extension__ _Static_assert(__VA_ARGS__)
 #endif
 
+namespace dr1812 { // dr1812: no
+   // NB: dup 1710
+#if __cplusplus >= 201103L
+template  struct A {
+  using B 

[PATCH] D151661: [clang] [test] Narrow down an MSVC specific behaviour to only not covever MinGW

2023-05-30 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill added a comment.

In D151661#4380060 , @mstorsjo wrote:

> In D151661#4379958 , @Endill wrote:
>
>> Thank you!
>> I've asked Aaron what is the best way to check for MSVC-like triple before 
>> relanding this test. So today we both learned.
>
> Generally, the canonical way to check for it is `#ifdef _MSC_VER` - however 
> in the `%clang_cc1` tests, it's not automatically defined. This, because the 
> driver heuristically tries to guess a MSVC version to mimic, which it then 
> passes as a version number to `clang -cc1` with `-fms-compatibility-version` 
> or similar. When invoking `clang -cc1` manually, this doesn't get set and 
> `_MSC_VER` is undefined.

Yes, I remember checking `_MSC_VER` and `_MSC_FULL_VER`, but they didn't work.

> (I'm considering changing code to make sure that `_MSC_VER` always is defined 
> in such cases too, even to a dummy version number .)

That would be fantastic for DR and conformance tests!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151661/new/

https://reviews.llvm.org/D151661

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D151661: [clang] [test] Narrow down an MSVC specific behaviour to only not covever MinGW

2023-05-29 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill accepted this revision.
Endill added a comment.
This revision is now accepted and ready to land.

Thank you!
I've asked Aaron what is the best way to check for MSVC-like triple before 
relanding this test. So today we both learned.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151661/new/

https://reviews.llvm.org/D151661

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D151634: [clang] Add test for CWG253

2023-05-28 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill updated this revision to Diff 526342.
Endill added a comment.

Update cxx_dr_status.html


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151634/new/

https://reviews.llvm.org/D151634

Files:
  clang/test/CXX/drs/dr0xx.cpp
  clang/test/CXX/drs/dr2xx.cpp
  clang/www/cxx_dr_status.html


Index: clang/www/cxx_dr_status.html
===
--- clang/www/cxx_dr_status.html
+++ clang/www/cxx_dr_status.html
@@ -505,7 +505,7 @@
 https://cplusplus.github.io/CWG/issues/78.html";>78
 CD1
 Section 8.5 paragraph 9 should state it only applies to non-static 
objects
-Superseded by 
+No
   
   
 https://cplusplus.github.io/CWG/issues/79.html";>79
@@ -1556,7 +1556,7 @@
 https://cplusplus.github.io/CWG/issues/253.html";>253
 C++17
 Why must empty or fully-initialized const objects be initialized?
-Unknown
+Clang 3.9
   
   
 https://cplusplus.github.io/CWG/issues/254.html";>254
@@ -3021,7 +3021,7 @@
 https://cplusplus.github.io/CWG/issues/497.html";>497
 CD1
 Missing required initialization in example
-Superseded by 253
+Superseded by 253
   
   
 https://cplusplus.github.io/CWG/issues/498.html";>498
Index: clang/test/CXX/drs/dr2xx.cpp
===
--- clang/test/CXX/drs/dr2xx.cpp
+++ clang/test/CXX/drs/dr2xx.cpp
@@ -4,6 +4,7 @@
 // RUN: %clang_cc1 -std=c++17 %s -verify -fexceptions -fcxx-exceptions 
-pedantic-errors
 // RUN: %clang_cc1 -std=c++20 %s -verify -fexceptions -fcxx-exceptions 
-pedantic-errors
 // RUN: %clang_cc1 -std=c++23 %s -verify -fexceptions -fcxx-exceptions 
-pedantic-errors
+// RUN: %clang_cc1 -std=c++2b %s -verify -fexceptions -fcxx-exceptions 
-pedantic-errors
 
 // PR13819 -- __SIZE_TYPE__ is incompatible.
 typedef __SIZE_TYPE__ size_t; // expected-error 0-1 {{extension}}
@@ -682,6 +683,17 @@
   G::~G() {}
 }
 
+namespace dr253 { // dr253: 3.9
+struct Z {
+  operator int() const { return 0; }
+};
+
+void f() {
+  const Z z1;  
+  const Z z2 = { };
+}
+} // namespace dr253
+
 namespace dr254 { // dr254: yes
   template struct A {
 typedef typename T::type type; // ok even if this is a typedef-name, 
because
Index: clang/test/CXX/drs/dr0xx.cpp
===
--- clang/test/CXX/drs/dr0xx.cpp
+++ clang/test/CXX/drs/dr0xx.cpp
@@ -4,6 +4,7 @@
 // RUN: %clang_cc1 -std=c++17 %s -verify -fexceptions -fcxx-exceptions 
-pedantic-errors -triple %itanium_abi_triple
 // RUN: %clang_cc1 -std=c++20 %s -verify -fexceptions -fcxx-exceptions 
-pedantic-errors -triple %itanium_abi_triple
 // RUN: %clang_cc1 -std=c++23 %s -verify -fexceptions -fcxx-exceptions 
-pedantic-errors -triple %itanium_abi_triple
+// RUN: %clang_cc1 -std=c++2b %s -verify -fexceptions -fcxx-exceptions 
-pedantic-errors -triple %itanium_abi_triple
 
 namespace dr1 { // dr1: no
   namespace X { extern "C" void dr1_f(int a = 1); }
@@ -1018,7 +1019,7 @@
   };
 }
 
-namespace dr78 { // dr78: sup 
+namespace dr78 { // dr78: no
   // Under DR78, this is valid, because 'k' has static storage duration, so is
   // zero-initialized.
   const int k; // expected-error {{default initialization of an object of 
const}}


Index: clang/www/cxx_dr_status.html
===
--- clang/www/cxx_dr_status.html
+++ clang/www/cxx_dr_status.html
@@ -505,7 +505,7 @@
 https://cplusplus.github.io/CWG/issues/78.html";>78
 CD1
 Section 8.5 paragraph 9 should state it only applies to non-static objects
-Superseded by 
+No
   
   
 https://cplusplus.github.io/CWG/issues/79.html";>79
@@ -1556,7 +1556,7 @@
 https://cplusplus.github.io/CWG/issues/253.html";>253
 C++17
 Why must empty or fully-initialized const objects be initialized?
-Unknown
+Clang 3.9
   
   
 https://cplusplus.github.io/CWG/issues/254.html";>254
@@ -3021,7 +3021,7 @@
 https://cplusplus.github.io/CWG/issues/497.html";>497
 CD1
 Missing required initialization in example
-Superseded by 253
+Superseded by 253
   
   
 https://cplusplus.github.io/CWG/issues/498.html";>498
Index: clang/test/CXX/drs/dr2xx.cpp
===
--- clang/test/CXX/drs/dr2xx.cpp
+++ clang/test/CXX/drs/dr2xx.cpp
@@ -4,6 +4,7 @@
 // RUN: %clang_cc1 -std=c++17 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
 // RUN: %clang_cc1 -std=c++20 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
 // RUN: %clang_cc1 -std=c++23 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++2b %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
 
 // PR13819 -- __SIZE_TYPE__ is incompatible.
 typedef __SIZE_TYPE__ size_t; // expected-error 0-1 {{extension}}
@@ -682,6 +683,17 @@
   G::~G() {}
 }
 
+namespace dr253 { // dr253: 3.9
+str

[PATCH] D151634: [clang] Add test for CWG253

2023-05-28 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill created this revision.
Endill added reviewers: clang-language-wg, shafik.
Herald added a project: All.
Endill requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Also mark CWG78 as "no". CWG253 is the only issue that references 78, and they 
reference the same paragraph, so I guess that's the issue Richard thought that 
supersedes 78.

I think they are different, though: 78 is concerned about initialization of 
static objectы when no initializer is specified, whereas 253 is concerned with 
users required to explicitly declare defaulted default constructor when they 
want to declare local object without initializer, when there's nothing to 
initialize (e.g. a struct without non-static data members).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D151634

Files:
  clang/test/CXX/drs/dr0xx.cpp
  clang/test/CXX/drs/dr2xx.cpp


Index: clang/test/CXX/drs/dr2xx.cpp
===
--- clang/test/CXX/drs/dr2xx.cpp
+++ clang/test/CXX/drs/dr2xx.cpp
@@ -4,6 +4,7 @@
 // RUN: %clang_cc1 -std=c++17 %s -verify -fexceptions -fcxx-exceptions 
-pedantic-errors
 // RUN: %clang_cc1 -std=c++20 %s -verify -fexceptions -fcxx-exceptions 
-pedantic-errors
 // RUN: %clang_cc1 -std=c++23 %s -verify -fexceptions -fcxx-exceptions 
-pedantic-errors
+// RUN: %clang_cc1 -std=c++2b %s -verify -fexceptions -fcxx-exceptions 
-pedantic-errors
 
 // PR13819 -- __SIZE_TYPE__ is incompatible.
 typedef __SIZE_TYPE__ size_t; // expected-error 0-1 {{extension}}
@@ -682,6 +683,17 @@
   G::~G() {}
 }
 
+namespace dr253 { // dr253: 3.9
+struct Z {
+  operator int() const { return 0; }
+};
+
+void f() {
+  const Z z1;  
+  const Z z2 = { };
+}
+} // namespace dr253
+
 namespace dr254 { // dr254: yes
   template struct A {
 typedef typename T::type type; // ok even if this is a typedef-name, 
because
Index: clang/test/CXX/drs/dr0xx.cpp
===
--- clang/test/CXX/drs/dr0xx.cpp
+++ clang/test/CXX/drs/dr0xx.cpp
@@ -4,6 +4,7 @@
 // RUN: %clang_cc1 -std=c++17 %s -verify -fexceptions -fcxx-exceptions 
-pedantic-errors -triple %itanium_abi_triple
 // RUN: %clang_cc1 -std=c++20 %s -verify -fexceptions -fcxx-exceptions 
-pedantic-errors -triple %itanium_abi_triple
 // RUN: %clang_cc1 -std=c++23 %s -verify -fexceptions -fcxx-exceptions 
-pedantic-errors -triple %itanium_abi_triple
+// RUN: %clang_cc1 -std=c++2b %s -verify -fexceptions -fcxx-exceptions 
-pedantic-errors -triple %itanium_abi_triple
 
 namespace dr1 { // dr1: no
   namespace X { extern "C" void dr1_f(int a = 1); }
@@ -1018,7 +1019,7 @@
   };
 }
 
-namespace dr78 { // dr78: sup 
+namespace dr78 { // dr78: no
   // Under DR78, this is valid, because 'k' has static storage duration, so is
   // zero-initialized.
   const int k; // expected-error {{default initialization of an object of 
const}}


Index: clang/test/CXX/drs/dr2xx.cpp
===
--- clang/test/CXX/drs/dr2xx.cpp
+++ clang/test/CXX/drs/dr2xx.cpp
@@ -4,6 +4,7 @@
 // RUN: %clang_cc1 -std=c++17 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
 // RUN: %clang_cc1 -std=c++20 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
 // RUN: %clang_cc1 -std=c++23 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++2b %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
 
 // PR13819 -- __SIZE_TYPE__ is incompatible.
 typedef __SIZE_TYPE__ size_t; // expected-error 0-1 {{extension}}
@@ -682,6 +683,17 @@
   G::~G() {}
 }
 
+namespace dr253 { // dr253: 3.9
+struct Z {
+  operator int() const { return 0; }
+};
+
+void f() {
+  const Z z1;  
+  const Z z2 = { };
+}
+} // namespace dr253
+
 namespace dr254 { // dr254: yes
   template struct A {
 typedef typename T::type type; // ok even if this is a typedef-name, because
Index: clang/test/CXX/drs/dr0xx.cpp
===
--- clang/test/CXX/drs/dr0xx.cpp
+++ clang/test/CXX/drs/dr0xx.cpp
@@ -4,6 +4,7 @@
 // RUN: %clang_cc1 -std=c++17 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors -triple %itanium_abi_triple
 // RUN: %clang_cc1 -std=c++20 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors -triple %itanium_abi_triple
 // RUN: %clang_cc1 -std=c++23 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors -triple %itanium_abi_triple
+// RUN: %clang_cc1 -std=c++2b %s -verify -fexceptions -fcxx-exceptions -pedantic-errors -triple %itanium_abi_triple
 
 namespace dr1 { // dr1: no
   namespace X { extern "C" void dr1_f(int a = 1); }
@@ -1018,7 +1019,7 @@
   };
 }
 
-namespace dr78 { // dr78: sup 
+namespace dr78 { // dr78: no
   // Under DR78, this is valid, because 'k' has static storage duration, so is
   // zero-initialized.
   const int k; // expected-error {{default initialization of an object of const}}
___

[PATCH] D151320: [clang] Add `// expected-maybe-no-diagnostics` comment to VerifyDiagnosticConsumer

2023-05-27 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill added inline comments.



Comment at: clang/lib/Frontend/VerifyDiagnosticConsumer.cpp:468
+Status = VerifyDiagnosticConsumer::HasExpectedMaybeNoDiagnostics;
+  continue;
+} else if (DToken.endswith(DType="-no-diagnostics")) {

jdenny wrote:
> Endill wrote:
> > jdenny wrote:
> > > Endill wrote:
> > > > jdenny wrote:
> > > > > Endill wrote:
> > > > > > jdenny wrote:
> > > > > > > This `continue` skips the prefix checking below, which is 
> > > > > > > important when there are multiple prefixes active (e.g., 
> > > > > > > `-verify=foo,bar`).  That is, any old 
> > > > > > > `BOGUS-maybe-no-diagnostics` will be effective then.
> > > > > > This should be fixed now. Thank you for spotting this!
> > > > > Thanks for the fix.  Please add a test so this bug doesn't pop up 
> > > > > again.
> > > > Done as A2 test
> > > Does A2 trigger the original bug?  I think there must be multiple 
> > > prefixes for this fix to matter.
> > I think prefix checking below works for a single prefix as well: 
> > https://github.com/llvm/llvm-project/blob/5217498dc88aa2de2b728462205ffa8b01d96cab/clang/lib/Frontend/CompilerInvocation.cpp#LL2382C47-L2382C47
> I downloaded this version of your patch: 
> .  That version has the bug 
> discussed in this comment thread.
> 
> I applied that patch and added test A2.  A2 passed.  That means A2 does not 
> reproduce the bug it was intended to reproduce.
> 
> Then I changed A2 to have `-verify=foo,bar`.  A2 then failed because it then 
> reproduced the bug.  (And of course with the current version of your patch, 
> it passes because you've fixed the bug.)
> 
> Please add such a test.
I replaced A2 test with more comprehensive E set of tests.

Surprisingly to me, `-verify` and `-verify=foo,bar` work quite differently 
because of `PH.Search()` call 40 lines above. I can't say I have full 
understanding what's going on, so I wrote a more comprehensive set of tests. 
Does this address your concern?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151320/new/

https://reviews.llvm.org/D151320

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D151320: [clang] Add `// expected-maybe-no-diagnostics` comment to VerifyDiagnosticConsumer

2023-05-27 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill updated this revision to Diff 526277.
Endill added a comment.

Replace A2 test with E1-E3 tests


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151320/new/

https://reviews.llvm.org/D151320

Files:
  clang/include/clang/Basic/DiagnosticFrontendKinds.td
  clang/include/clang/Frontend/VerifyDiagnosticConsumer.h
  clang/lib/Frontend/VerifyDiagnosticConsumer.cpp
  clang/test/Frontend/verify-maybe-no-diagnostics.c
  clang/test/Frontend/verify3.c

Index: clang/test/Frontend/verify3.c
===
--- clang/test/Frontend/verify3.c
+++ clang/test/Frontend/verify3.c
@@ -19,7 +19,7 @@
 // expected-no-diagnostics
 
 //  CHECK2: error: 'error' diagnostics seen but not expected:
-// CHECK2-NEXT:   Line 19: 'expected-no-diagnostics' directive cannot follow other expected directives
+// CHECK2-NEXT:   Line 19: 'expected-no-diagnostics' directive cannot follow directives that expect diagnostics
 // CHECK2-NEXT: 1 error generated.
 #endif
 
Index: clang/test/Frontend/verify-maybe-no-diagnostics.c
===
--- /dev/null
+++ clang/test/Frontend/verify-maybe-no-diagnostics.c
@@ -0,0 +1,161 @@
+// RUN: %clang_cc1 -DTEST_A1 -verify %s
+// RUN: not %clang_cc1 -DTEST_A2 -verify %s 2>&1 | FileCheck --check-prefix=A2-CHECK %s
+// RUN: %clang_cc1 -DTEST_B1 -verify %s
+// RUN: %clang_cc1 -DTEST_B2 -verify %s
+// RUN: %clang_cc1 -DTEST_C1 -verify %s
+// RUN: not %clang_cc1 -DTEST_C2 -verify %s 2>&1 | FileCheck --check-prefix=C2-CHECK %s
+// RUN: %clang_cc1 -DTEST_C3 -verify %s
+// RUN: not %clang_cc1 -DTEST_C4 -verify %s 2>&1 | FileCheck --check-prefix=C4-CHECK %s
+// RUN: not %clang_cc1 -DTEST_D1 -verify %s 2>&1 | FileCheck --check-prefix=D1-CHECK %s
+// RUN: not %clang_cc1 -DTEST_D2 -verify %s 2>&1 | FileCheck --check-prefix=D2-CHECK %s
+// RUN: not %clang_cc1 -DTEST_D3 -verify %s 2>&1 | FileCheck --check-prefix=D3-CHECK %s
+// RUN: not %clang_cc1 -DTEST_D4 -verify %s 2>&1 | FileCheck --check-prefix=D4-CHECK %s
+// RUN: not %clang_cc1 -DTEST_D5 -verify %s 2>&1 | FileCheck --check-prefix=D5-CHECK %s
+// RUN: not %clang_cc1 -DTEST_D6 -verify %s 2>&1 | FileCheck --check-prefix=D6-CHECK %s
+// RUN: not %clang_cc1 -DTEST_E1 -verify %s 2>&1 | FileCheck --check-prefix=E1-CHECK %s
+// RUN: not %clang_cc1 -DTEST_E2 -verify %s 2>&1 | FileCheck --check-prefix=E2-CHECK %s
+// RUN: not %clang_cc1 -DTEST_E3 -verify %s 2>&1 | FileCheck --check-prefix=E3-CHECK %s
+// RUN: not %clang_cc1 -DTEST_E1 -verify=foo,bar %s 2>&1 | FileCheck --check-prefix=E1-CHECK %s
+// RUN: not %clang_cc1 -DTEST_E2 -verify=foo,bar %s 2>&1 | FileCheck --check-prefix=E2-CHECK %s
+// RUN: not %clang_cc1 -DTEST_E3 -verify=foo,bar %s 2>&1 | FileCheck --check-prefix=E3-CHECK %s
+
+#ifdef TEST_A1
+// expected-maybe-no-diagnostics
+#endif
+
+#ifdef TEST_A2
+// expected-maybe-no-diagnostics-re
+
+//  A2-CHECK: error: no expected directives found: consider use of 'expected-no-diagnostics'
+// A2-CHECK-NEXT: 1 error generated.
+#endif
+
+#ifdef TEST_B1
+// expected-maybe-no-diagnostics
+// expected-no-diagnostics
+#endif
+
+#ifdef TEST_B2
+// expected-no-diagnostics
+// expected-maybe-no-diagnostics
+#endif
+
+#ifdef TEST_C1
+// expected-maybe-no-diagnostics
+#error test_c1
+// expected-error@-1 {{test_c1}}
+#endif
+
+#ifdef TEST_C2
+// expected-maybe-no-diagnostics
+#error test_c2
+
+//  C2-CHECK: error: 'error' diagnostics seen but not expected:
+// C2-CHECK-NEXT:   {{test_c2}}
+// C2-CHECK-NEXT: 1 error generated.
+#endif
+
+#ifdef TEST_C3
+#error test_c3
+// expected-error@-1 {{test_c3}}
+// expected-maybe-no-diagnostics
+#endif
+
+#ifdef TEST_C4
+#error test_c4
+// expected-maybe-no-diagnostics
+
+//  C4-CHECK: error: 'error' diagnostics seen but not expected:
+// C4-CHECK-NEXT:   {{test_c4}}
+// C4-CHECK-NEXT: 1 error generated.
+#endif
+
+#ifdef TEST_D1
+// expected-maybe-no-diagnostics
+#error test_d1
+// expected-error@-1 {{test_d1}}
+// expected-no-diagnostics
+
+//  D1-CHECK: error: 'error' diagnostics seen but not expected:
+// D1-CHECK-NEXT:   {{.*}} 'expected-no-diagnostics' directive cannot follow directives that expect diagnostics
+// D1-CHECK-NEXT: 1 error generated.
+#endif
+
+#ifdef TEST_D2
+// expected-maybe-no-diagnostics
+// expected-no-diagnostics
+#error test_d2
+// expected-error@-1 {{test_d2}}
+
+//  D2-CHECK: error: 'error' diagnostics seen but not expected:
+// D2-CHECK-NEXT:   {{test_d2}}
+// D2-CHECK-NEXT:   {{.*}} expected directive cannot follow 'expected-no-diagnostics' directive
+// D2-CHECK-NEXT: 2 errors generated.
+#endif
+
+#ifdef TEST_D3
+// expected-no-diagnostics
+// expected-maybe-no-diagnostics
+#error test_d3
+// expected-error@-1 {{test_d3}}
+
+//  D3-CHECK: error: 'error' diagnostics seen but not expected:
+// D3-CHECK-NEXT:   {{test_d3}}
+// D3-CHECK-NEXT:   {{.*}} expected directive cannot follow 'expected-no-diagnostics' directive
+// D3-CHEC

[PATCH] D151320: [clang] Add `// expected-maybe-no-diagnostics` comment to VerifyDiagnosticConsumer

2023-05-26 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill added a comment.

Thank you for your time!




Comment at: clang/lib/Frontend/VerifyDiagnosticConsumer.cpp:468
+Status = VerifyDiagnosticConsumer::HasExpectedMaybeNoDiagnostics;
+  continue;
+} else if (DToken.endswith(DType="-no-diagnostics")) {

jdenny wrote:
> Endill wrote:
> > jdenny wrote:
> > > Endill wrote:
> > > > jdenny wrote:
> > > > > This `continue` skips the prefix checking below, which is important 
> > > > > when there are multiple prefixes active (e.g., `-verify=foo,bar`).  
> > > > > That is, any old `BOGUS-maybe-no-diagnostics` will be effective then.
> > > > This should be fixed now. Thank you for spotting this!
> > > Thanks for the fix.  Please add a test so this bug doesn't pop up again.
> > Done as A2 test
> Does A2 trigger the original bug?  I think there must be multiple prefixes 
> for this fix to matter.
I think prefix checking below works for a single prefix as well: 
https://github.com/llvm/llvm-project/blob/5217498dc88aa2de2b728462205ffa8b01d96cab/clang/lib/Frontend/CompilerInvocation.cpp#LL2382C47-L2382C47


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151320/new/

https://reviews.llvm.org/D151320

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D151320: [clang] Add `// expected-maybe-no-diagnostics` comment to VerifyDiagnosticConsumer

2023-05-26 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill added inline comments.



Comment at: clang/include/clang/Frontend/VerifyDiagnosticConsumer.h:186-202
+/// Additionally, you can use:
+///
+/// \code
+///   // expected-maybe-no-diagnostics
+/// \endcode
+///
+/// to specify that a file with no "expected-*" comments should pass when no

jdenny wrote:
> Thanks for adding documentation.
> 
> I feel that this edit makes the behavior a little clearer, and it clarifies 
> what happens when "expected-no-diagnostics" and 
> "expected-maybe-no-diagnostics" are combined.
> 
> Also, the original text had:
> 
> > but they do not fail automatically due to a combination of 
> > "expected-no-diagnostics" and "expected-*" within the same test
> 
> That reads to me like it's ok to combine "expected-no-diagnostics" and 
> "expected-*" directives specifying diagnostics.  Hopefully this edit 
> clarifies that point.
> 
Yeah, it's better the way you propose.



Comment at: clang/lib/Frontend/VerifyDiagnosticConsumer.cpp:470-471
   NoDiag = true;
   if (D.RegexKind)
 continue;
 }

jdenny wrote:
> Shouldn't `expected-maybe-no-diagnostics` have this too so that 
> `expected-maybe-no-diagnostics-re` is skipped?  Please add a test.
You're right, there's no good reason for us not to do the same. Though I don't 
like that we silently skip over not-too-sensical `// 
expected-no-diagnostics-re`. I'll prepare a follow-up patch that makes `-re` a 
hard error for those two special directives.

Tested in A3



Comment at: clang/lib/Frontend/VerifyDiagnosticConsumer.cpp:468
+Status = VerifyDiagnosticConsumer::HasExpectedMaybeNoDiagnostics;
+  continue;
+} else if (DToken.endswith(DType="-no-diagnostics")) {

jdenny wrote:
> Endill wrote:
> > jdenny wrote:
> > > This `continue` skips the prefix checking below, which is important when 
> > > there are multiple prefixes active (e.g., `-verify=foo,bar`).  That is, 
> > > any old `BOGUS-maybe-no-diagnostics` will be effective then.
> > This should be fixed now. Thank you for spotting this!
> Thanks for the fix.  Please add a test so this bug doesn't pop up again.
Done as A2 test



Comment at: clang/test/Frontend/verify-maybe-no-diagnostics.c:104
+//  D6-CHECK: error: 'error' diagnostics seen but not expected:
+// D6-CHECK-NEXT:   {{.*}} 'expected-no-diagnostics' directive cannot follow 
other expected directives
+// D6-CHECK-NEXT: 1 error generated.

jdenny wrote:
> Endill wrote:
> > jdenny wrote:
> > > This diagnostic is confusing.  Should we add "except 
> > > 'expected-maybe-no-diagnostics'"?
> > As I mentioned in another comment, `maybe-no-diagnostics` has the lowest 
> > priority, and doesn't have strict and declarative nature, unlike any other 
> > directive. That's why it should never be expected (and ideally very rarely 
> > used).
> > 
> > The purpose of all the tests I added is to ensure `expected-no-diagnostic` 
> > doesn't affect existing directives and their interaction in any way.
> I don't see how that addresses my concern.  Maybe it's because, after the 
> latest edits, phab shifted my comment to the wrong test.  I was originally 
> commenting on this:
> 
> > 'expected-no-diagnostics' directive cannot follow other expected directives
> 
> This message is now incorrect.  `expected-no-diagnostics` //can// follow 
> `expected-maybe-no-diagnostics`.  What if we reword as follows?
> 
> > 'expected-no-diagnostics' directive cannot follow directives that expect 
> > diagnostics
Sorry, I misunderstood your initial comment. It's fixed now.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151320/new/

https://reviews.llvm.org/D151320

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D151320: [clang] Add `// expected-maybe-no-diagnostics` comment to VerifyDiagnosticConsumer

2023-05-26 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill updated this revision to Diff 526101.
Endill added a comment.

Address feedback


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151320/new/

https://reviews.llvm.org/D151320

Files:
  clang/include/clang/Basic/DiagnosticFrontendKinds.td
  clang/include/clang/Frontend/VerifyDiagnosticConsumer.h
  clang/lib/Frontend/VerifyDiagnosticConsumer.cpp
  clang/test/Frontend/verify-maybe-no-diagnostics.c
  clang/test/Frontend/verify3.c

Index: clang/test/Frontend/verify3.c
===
--- clang/test/Frontend/verify3.c
+++ clang/test/Frontend/verify3.c
@@ -19,7 +19,7 @@
 // expected-no-diagnostics
 
 //  CHECK2: error: 'error' diagnostics seen but not expected:
-// CHECK2-NEXT:   Line 19: 'expected-no-diagnostics' directive cannot follow other expected directives
+// CHECK2-NEXT:   Line 19: 'expected-no-diagnostics' directive cannot follow directives that expect diagnostics
 // CHECK2-NEXT: 1 error generated.
 #endif
 
Index: clang/test/Frontend/verify-maybe-no-diagnostics.c
===
--- /dev/null
+++ clang/test/Frontend/verify-maybe-no-diagnostics.c
@@ -0,0 +1,142 @@
+// RUN: %clang_cc1 -DTEST_A1 -verify %s
+// RUN: not %clang_cc1 -DTEST_A2 -verify %s 2>&1 | FileCheck --check-prefix=A2-CHECK %s
+// RUN: not %clang_cc1 -DTEST_A3 -verify %s 2>&1 | FileCheck --check-prefix=A3-CHECK %s
+// RUN: %clang_cc1 -DTEST_B1 -verify %s
+// RUN: %clang_cc1 -DTEST_B2 -verify %s
+// RUN: %clang_cc1 -DTEST_C1 -verify %s
+// RUN: not %clang_cc1 -DTEST_C2 -verify %s 2>&1 | FileCheck --check-prefix=C2-CHECK %s
+// RUN: %clang_cc1 -DTEST_C3 -verify %s
+// RUN: not %clang_cc1 -DTEST_C4 -verify %s 2>&1 | FileCheck --check-prefix=C4-CHECK %s
+// RUN: not %clang_cc1 -DTEST_D1 -verify %s 2>&1 | FileCheck --check-prefix=D1-CHECK %s
+// RUN: not %clang_cc1 -DTEST_D2 -verify %s 2>&1 | FileCheck --check-prefix=D2-CHECK %s
+// RUN: not %clang_cc1 -DTEST_D3 -verify %s 2>&1 | FileCheck --check-prefix=D3-CHECK %s
+// RUN: not %clang_cc1 -DTEST_D4 -verify %s 2>&1 | FileCheck --check-prefix=D4-CHECK %s
+// RUN: not %clang_cc1 -DTEST_D5 -verify %s 2>&1 | FileCheck --check-prefix=D5-CHECK %s
+// RUN: not %clang_cc1 -DTEST_D6 -verify %s 2>&1 | FileCheck --check-prefix=D6-CHECK %s
+
+#ifdef TEST_A1
+// expected-maybe-no-diagnostics
+#endif
+
+#ifdef TEST_A2
+// BOGUS-maybe-no-diagnostics
+
+//  A2-CHECK: error: no expected directives found: consider use of 'expected-no-diagnostics'
+// A2-CHECK-NEXT: 1 error generated.
+#endif
+
+#ifdef TEST_A3
+// expected-maybe-no-diagnostics-re
+
+//  A3-CHECK: error: no expected directives found: consider use of 'expected-no-diagnostics'
+// A3-CHECK-NEXT: 1 error generated.
+#endif
+
+#ifdef TEST_B1
+// expected-maybe-no-diagnostics
+// expected-no-diagnostics
+#endif
+
+#ifdef TEST_B2
+// expected-no-diagnostics
+// expected-maybe-no-diagnostics
+#endif
+
+#ifdef TEST_C1
+// expected-maybe-no-diagnostics
+#error test_c1
+// expected-error@-1 {{test_c1}}
+#endif
+
+#ifdef TEST_C2
+// expected-maybe-no-diagnostics
+#error test_c2
+
+//  C2-CHECK: error: 'error' diagnostics seen but not expected:
+// C2-CHECK-NEXT:   {{test_c2}}
+// C2-CHECK-NEXT: 1 error generated.
+#endif
+
+#ifdef TEST_C3
+#error test_c3
+// expected-error@-1 {{test_c3}}
+// expected-maybe-no-diagnostics
+#endif
+
+#ifdef TEST_C4
+#error test_c4
+// expected-maybe-no-diagnostics
+
+//  C4-CHECK: error: 'error' diagnostics seen but not expected:
+// C4-CHECK-NEXT:   {{test_c4}}
+// C4-CHECK-NEXT: 1 error generated.
+#endif
+
+#ifdef TEST_D1
+// expected-maybe-no-diagnostics
+#error test_d1
+// expected-error@-1 {{test_d1}}
+// expected-no-diagnostics
+
+//  D1-CHECK: error: 'error' diagnostics seen but not expected:
+// D1-CHECK-NEXT:   {{.*}} 'expected-no-diagnostics' directive cannot follow directives that expect diagnostics
+// D1-CHECK-NEXT: 1 error generated.
+#endif
+
+#ifdef TEST_D2
+// expected-maybe-no-diagnostics
+// expected-no-diagnostics
+#error test_d2
+// expected-error@-1 {{test_d2}}
+
+//  D2-CHECK: error: 'error' diagnostics seen but not expected:
+// D2-CHECK-NEXT:   {{test_d2}}
+// D2-CHECK-NEXT:   {{.*}} expected directive cannot follow 'expected-no-diagnostics' directive
+// D2-CHECK-NEXT: 2 errors generated.
+#endif
+
+#ifdef TEST_D3
+// expected-no-diagnostics
+// expected-maybe-no-diagnostics
+#error test_d3
+// expected-error@-1 {{test_d3}}
+
+//  D3-CHECK: error: 'error' diagnostics seen but not expected:
+// D3-CHECK-NEXT:   {{test_d3}}
+// D3-CHECK-NEXT:   {{.*}} expected directive cannot follow 'expected-no-diagnostics' directive
+// D3-CHECK-NEXT: 2 errors generated.
+#endif
+
+#ifdef TEST_D4
+// expected-no-diagnostics
+#error test_d4
+// expected-error@-1 {{test_d4}}
+// expected-maybe-no-diagnostics
+
+//  D4-CHECK: error: 'error' diagnostics seen but not expected:
+// D4-CHECK-NEXT:   {{test_d4}}
+// D4-CHECK-NEXT:  

[PATCH] D151320: [clang] Add `// expected-maybe-no-diagnostics` comment to VerifyDiagnosticConsumer

2023-05-26 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill added a comment.

Thank you for the review!




Comment at: clang/lib/Frontend/VerifyDiagnosticConsumer.cpp:468
+Status = VerifyDiagnosticConsumer::HasExpectedMaybeNoDiagnostics;
+  continue;
+} else if (DToken.endswith(DType="-no-diagnostics")) {

jdenny wrote:
> This `continue` skips the prefix checking below, which is important when 
> there are multiple prefixes active (e.g., `-verify=foo,bar`).  That is, any 
> old `BOGUS-maybe-no-diagnostics` will be effective then.
This should be fixed now. Thank you for spotting this!



Comment at: clang/test/Frontend/verify-maybe-no-diagnostics.c:38
+#endif
+
+#ifdef TEST_D1

jdenny wrote:
> Please test this case:
> 
> ```
> #ifdef TEST_C3
> // expected-maybe-no-diagnostics
> #error test_c3
> #endif
> ```
> 
> That is, does Clang actually fail in this case as expected because there's an 
> error and no corresponding `expected-error` directive?  Or does it ignore the 
> error because of the `expected-maybe-no-diagnostics` directive?
Added C2 and C4 tests that should cover that.

> That is, does Clang actually fail in this case as expected because there's an 
> error and no corresponding expected-error directive? Or does it ignore the 
> error because of the expected-maybe-no-diagnostics directive?

It works like there's no `// expected-maybe-no-diagnostics`. That is, failing 
because there's no matching `expected-error` directive for an error produced.



Comment at: clang/test/Frontend/verify-maybe-no-diagnostics.c:51-52
+#ifdef TEST_D2
+// expected-maybe-no-diagnostics
+// expected-no-diagnostics
+#error test_d2

jdenny wrote:
> So `expected-no-diagnostics` overrides `expected-maybe-no-diagnostics`.  In 
> your use case, omitting one or the other is not always possible?
Yes, it works the way you describe.
In our case, `// expected-maybe-no-diagnostic` comes into hundreds of test 
cases from force include. It's very much possible for us to ensure that only 
one of them is present, by banning `expected-no-diagnostics`.

`expected-maybe-no-diagnostic` is by design low-priority and no-friction 
directive, contrary to strict nature of all other directives. That's why it 
could be very easily overridden.



Comment at: clang/test/Frontend/verify-maybe-no-diagnostics.c:104
+//  D6-CHECK: error: 'error' diagnostics seen but not expected:
+// D6-CHECK-NEXT:   {{.*}} 'expected-no-diagnostics' directive cannot follow 
other expected directives
+// D6-CHECK-NEXT: 1 error generated.

jdenny wrote:
> This diagnostic is confusing.  Should we add "except 
> 'expected-maybe-no-diagnostics'"?
As I mentioned in another comment, `maybe-no-diagnostics` has the lowest 
priority, and doesn't have strict and declarative nature, unlike any other 
directive. That's why it should never be expected (and ideally very rarely 
used).

The purpose of all the tests I added is to ensure `expected-no-diagnostic` 
doesn't affect existing directives and their interaction in any way.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151320/new/

https://reviews.llvm.org/D151320

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D151320: [clang] Add `// expected-maybe-no-diagnostics` comment to VerifyDiagnosticConsumer

2023-05-26 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill updated this revision to Diff 526013.
Endill edited the summary of this revision.
Endill added a comment.

Address feedback
Docs contributed by @aaron.ballman


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151320/new/

https://reviews.llvm.org/D151320

Files:
  clang/include/clang/Frontend/VerifyDiagnosticConsumer.h
  clang/lib/Frontend/VerifyDiagnosticConsumer.cpp
  clang/test/Frontend/verify-maybe-no-diagnostics.c

Index: clang/test/Frontend/verify-maybe-no-diagnostics.c
===
--- clang/test/Frontend/verify-maybe-no-diagnostics.c
+++ clang/test/Frontend/verify-maybe-no-diagnostics.c
@@ -2,7 +2,9 @@
 // RUN: %clang_cc1 -DTEST_B1 -verify %s
 // RUN: %clang_cc1 -DTEST_B2 -verify %s
 // RUN: %clang_cc1 -DTEST_C1 -verify %s
-// RUN: %clang_cc1 -DTEST_C2 -verify %s
+// RUN: not %clang_cc1 -DTEST_C2 -verify %s 2>&1 | FileCheck --check-prefix=C2-CHECK %s
+// RUN: %clang_cc1 -DTEST_C3 -verify %s
+// RUN: not %clang_cc1 -DTEST_C4 -verify %s 2>&1 | FileCheck --check-prefix=C4-CHECK %s
 // RUN: not %clang_cc1 -DTEST_D1 -verify %s 2>&1 | FileCheck --check-prefix=D1-CHECK %s
 // RUN: not %clang_cc1 -DTEST_D2 -verify %s 2>&1 | FileCheck --check-prefix=D2-CHECK %s
 // RUN: not %clang_cc1 -DTEST_D3 -verify %s 2>&1 | FileCheck --check-prefix=D3-CHECK %s
@@ -31,11 +33,29 @@
 #endif
 
 #ifdef TEST_C2
+// expected-maybe-no-diagnostics
 #error test_c2
-// expected-error@-1 {{test_c2}}
+
+//  C2-CHECK: error: 'error' diagnostics seen but not expected:
+// C2-CHECK-NEXT:   {{test_c2}}
+// C2-CHECK-NEXT: 1 error generated.
+#endif
+
+#ifdef TEST_C3
+#error test_c3
+// expected-error@-1 {{test_c3}}
 // expected-maybe-no-diagnostics
 #endif
 
+#ifdef TEST_C4
+#error test_c4
+// expected-maybe-no-diagnostics
+
+//  C4-CHECK: error: 'error' diagnostics seen but not expected:
+// C4-CHECK-NEXT:   {{test_c4}}
+// C4-CHECK-NEXT: 1 error generated.
+#endif
+
 #ifdef TEST_D1
 // expected-maybe-no-diagnostics
 #error test_d1
Index: clang/lib/Frontend/VerifyDiagnosticConsumer.cpp
===
--- clang/lib/Frontend/VerifyDiagnosticConsumer.cpp
+++ clang/lib/Frontend/VerifyDiagnosticConsumer.cpp
@@ -453,6 +453,7 @@
 
 // Type in initial directive token: -{error|warning|note|no-diagnostics}
 bool NoDiag = false;
+bool MaybeNoDiag = false;
 StringRef DType;
 if (DToken.endswith(DType="-error"))
   D.DL = ED ? &ED->Errors : nullptr;
@@ -462,11 +463,9 @@
   D.DL = ED ? &ED->Remarks : nullptr;
 else if (DToken.endswith(DType="-note"))
   D.DL = ED ? &ED->Notes : nullptr;
-else if (DToken.endswith(DType="-maybe-no-diagnostics")) {
-  if (Status == VerifyDiagnosticConsumer::HasNoDirectives)
-Status = VerifyDiagnosticConsumer::HasExpectedMaybeNoDiagnostics;
-  continue;
-} else if (DToken.endswith(DType="-no-diagnostics")) {
+else if (DToken.endswith(DType="-maybe-no-diagnostics"))
+  MaybeNoDiag = true;
+else if (DToken.endswith(DType="-no-diagnostics")) {
   NoDiag = true;
   if (D.RegexKind)
 continue;
@@ -481,6 +480,12 @@
 if (!std::binary_search(Prefixes.begin(), Prefixes.end(), DToken))
   continue;
 
+if (MaybeNoDiag) {
+  if (Status == VerifyDiagnosticConsumer::HasNoDirectives)
+Status = VerifyDiagnosticConsumer::HasExpectedMaybeNoDiagnostics;
+  continue;
+}
+
 if (NoDiag) {
   if (Status == VerifyDiagnosticConsumer::HasOtherExpectedDirectives)
 Diags.Report(Pos, diag::err_verify_invalid_no_diags)
Index: clang/include/clang/Frontend/VerifyDiagnosticConsumer.h
===
--- clang/include/clang/Frontend/VerifyDiagnosticConsumer.h
+++ clang/include/clang/Frontend/VerifyDiagnosticConsumer.h
@@ -183,6 +183,23 @@
 ///   // expected-no-diagnostics
 /// \endcode
 ///
+/// Additionally, you can use:
+///
+/// \code
+///   // expected-maybe-no-diagnostics
+/// \endcode
+///
+/// to specify that a file with no "expected-*" comments should pass when no
+/// diagnostics are generated, but doesn't conflict with "expected-*" directives
+/// when they are present. This situation mostly comes up for DR conformance tests
+/// where dozens of distinct test cases are within the same physical file but use
+/// the 'split-file' utility to split individual test cases into logical files
+/// at runtime. In that case, a header file containing "expected-maybe-no-diagnostics"
+/// can be force included into each RUN line in the physical file. The tests that
+/// expect diagostics continue to pass or fail depending on whether the correct
+/// diagnostics are emitted, but they do not fail automatically due to a
+/// combination of "expected-no-diagnostics" and "expected-*" within the same
+/// test. The "expected-no-diagnostics" comment is almost always preferred.
 class VerifyDiagnosticConsumer: publ

[PATCH] D151426: [Clang][NFC] Prepare C++ DR suite for better test isolation

2023-05-25 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill added a comment.

In D151426#4371730 , @aaron.ballman 
wrote:

> The changes LGTM (verified off-list that the regenerated HTML is identical 
> before and after this change),

I've run `make_cxx_dr_status` on top of this patch, and learned that the patch 
didn't change anything in `cxx_dr_status.html`, and that it has been written 
resilient enough to happily digest the new notation of status comments.

> but let's not land this until we've gotten farther along the review process 
> with the related changes to split-file and the diagnostic verifier (just in 
> case those reviews cause us to change direction for some reason).

I don't mind being cautious here. Even though initial feedback on every of them 
doesn't seem to reject the direction we've been pushing towards. Here are the 
patches we're waiting for:

- https://reviews.llvm.org/D150856
- https://reviews.llvm.org/D150990
- https://reviews.llvm.org/D151320


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151426/new/

https://reviews.llvm.org/D151426

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D151320: [clang] Add `// expected-maybe-no-diagnostics` comment to VerifyDiagnosticConsumer

2023-05-24 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill marked an inline comment as done.
Endill added a comment.

Thank for for providing a nice explanation!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151320/new/

https://reviews.llvm.org/D151320

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D151320: [clang] Add `// expected-maybe-no-diagnostics` comment to VerifyDiagnosticConsumer

2023-05-24 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill updated this revision to Diff 525216.
Endill added a comment.

Add missing comma after enum item


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151320/new/

https://reviews.llvm.org/D151320

Files:
  clang/include/clang/Frontend/VerifyDiagnosticConsumer.h
  clang/lib/Frontend/VerifyDiagnosticConsumer.cpp
  clang/test/Frontend/verify-maybe-no-diagnostics.c

Index: clang/test/Frontend/verify-maybe-no-diagnostics.c
===
--- /dev/null
+++ clang/test/Frontend/verify-maybe-no-diagnostics.c
@@ -0,0 +1,106 @@
+// RUN: %clang_cc1 -DTEST_A1 -verify %s
+// RUN: %clang_cc1 -DTEST_B1 -verify %s
+// RUN: %clang_cc1 -DTEST_B2 -verify %s
+// RUN: %clang_cc1 -DTEST_C1 -verify %s
+// RUN: %clang_cc1 -DTEST_C2 -verify %s
+// RUN: not %clang_cc1 -DTEST_D1 -verify %s 2>&1 | FileCheck --check-prefix=D1-CHECK %s
+// RUN: not %clang_cc1 -DTEST_D2 -verify %s 2>&1 | FileCheck --check-prefix=D2-CHECK %s
+// RUN: not %clang_cc1 -DTEST_D3 -verify %s 2>&1 | FileCheck --check-prefix=D3-CHECK %s
+// RUN: not %clang_cc1 -DTEST_D4 -verify %s 2>&1 | FileCheck --check-prefix=D4-CHECK %s
+// RUN: not %clang_cc1 -DTEST_D5 -verify %s 2>&1 | FileCheck --check-prefix=D5-CHECK %s
+// RUN: not %clang_cc1 -DTEST_D6 -verify %s 2>&1 | FileCheck --check-prefix=D6-CHECK %s
+
+#ifdef TEST_A1
+// expected-maybe-no-diagnostics
+#endif
+
+#ifdef TEST_B1
+// expected-maybe-no-diagnostics
+// expected-no-diagnostics
+#endif
+
+#ifdef TEST_B2
+// expected-no-diagnostics
+// expected-maybe-no-diagnostics
+#endif
+
+#ifdef TEST_C1
+// expected-maybe-no-diagnostics
+#error test_c1
+// expected-error@-1 {{test_c1}}
+#endif
+
+#ifdef TEST_C2
+#error test_c2
+// expected-error@-1 {{test_c2}}
+// expected-maybe-no-diagnostics
+#endif
+
+#ifdef TEST_D1
+// expected-maybe-no-diagnostics
+#error test_d1
+// expected-error@-1 {{test_d1}}
+// expected-no-diagnostics
+
+//  D1-CHECK: error: 'error' diagnostics seen but not expected:
+// D1-CHECK-NEXT:   {{.*}} 'expected-no-diagnostics' directive cannot follow other expected directives
+// D1-CHECK-NEXT: 1 error generated.
+#endif
+
+#ifdef TEST_D2
+// expected-maybe-no-diagnostics
+// expected-no-diagnostics
+#error test_d2
+// expected-error@-1 {{test_d2}}
+
+//  D2-CHECK: error: 'error' diagnostics seen but not expected:
+// D2-CHECK-NEXT:   {{test_d2}}
+// D2-CHECK-NEXT:   {{.*}} expected directive cannot follow 'expected-no-diagnostics' directive
+// D2-CHECK-NEXT: 2 errors generated.
+#endif
+
+#ifdef TEST_D3
+// expected-no-diagnostics
+// expected-maybe-no-diagnostics
+#error test_d3
+// expected-error@-1 {{test_d3}}
+
+//  D3-CHECK: error: 'error' diagnostics seen but not expected:
+// D3-CHECK-NEXT:   {{test_d3}}
+// D3-CHECK-NEXT:   {{.*}} expected directive cannot follow 'expected-no-diagnostics' directive
+// D3-CHECK-NEXT: 2 errors generated.
+#endif
+
+#ifdef TEST_D4
+// expected-no-diagnostics
+#error test_d4
+// expected-error@-1 {{test_d4}}
+// expected-maybe-no-diagnostics
+
+//  D4-CHECK: error: 'error' diagnostics seen but not expected:
+// D4-CHECK-NEXT:   {{test_d4}}
+// D4-CHECK-NEXT:   {{.*}} expected directive cannot follow 'expected-no-diagnostics' directive
+// D4-CHECK-NEXT: 2 errors generated.
+#endif
+
+#ifdef TEST_D5
+#error test_d5
+// expected-error@-1 {{test_d5}}
+// expected-no-diagnostics
+// expected-maybe-no-diagnostics
+
+//  D5-CHECK: error: 'error' diagnostics seen but not expected:
+// D5-CHECK-NEXT:   {{.*}} 'expected-no-diagnostics' directive cannot follow other expected directives
+// D5-CHECK-NEXT: 1 error generated.
+#endif
+
+#ifdef TEST_D6
+#error test_d6
+// expected-error@-1 {{test_d6}}
+// expected-maybe-no-diagnostics
+// expected-no-diagnostics
+
+//  D6-CHECK: error: 'error' diagnostics seen but not expected:
+// D6-CHECK-NEXT:   {{.*}} 'expected-no-diagnostics' directive cannot follow other expected directives
+// D6-CHECK-NEXT: 1 error generated.
+#endif
Index: clang/lib/Frontend/VerifyDiagnosticConsumer.cpp
===
--- clang/lib/Frontend/VerifyDiagnosticConsumer.cpp
+++ clang/lib/Frontend/VerifyDiagnosticConsumer.cpp
@@ -462,7 +462,11 @@
   D.DL = ED ? &ED->Remarks : nullptr;
 else if (DToken.endswith(DType="-note"))
   D.DL = ED ? &ED->Notes : nullptr;
-else if (DToken.endswith(DType="-no-diagnostics")) {
+else if (DToken.endswith(DType="-maybe-no-diagnostics")) {
+  if (Status == VerifyDiagnosticConsumer::HasNoDirectives)
+Status = VerifyDiagnosticConsumer::HasExpectedMaybeNoDiagnostics;
+  continue;
+} else if (DToken.endswith(DType="-no-diagnostics")) {
   NoDiag = true;
   if (D.RegexKind)
 continue;
Index: clang/include/clang/Frontend/VerifyDiagnosticConsumer.h
===
--- clang/include/clang/Frontend/VerifyDiagnosticConsumer.h
+++ clang/include/cl

[PATCH] D151320: [clang] Add `// expected-maybe-no-diagnostics` comment to VerifyDiagnosticConsumer

2023-05-24 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill created this revision.
Endill added reviewers: aaron.ballman, hfinkel, dblaikie.
Herald added a project: All.
Endill requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This patch introduces a `// expected-maybe-not-diagnostic` that silence 
warnings about missing `// expected-no-diagnostic`, but doesn't conflict with 
`// expected-error` directives.

I go into details in the Discourse thread 

 about why we need this, and why we need this in the form implemented.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D151320

Files:
  clang/include/clang/Frontend/VerifyDiagnosticConsumer.h
  clang/lib/Frontend/VerifyDiagnosticConsumer.cpp
  clang/test/Frontend/verify-maybe-no-diagnostics.c

Index: clang/test/Frontend/verify-maybe-no-diagnostics.c
===
--- /dev/null
+++ clang/test/Frontend/verify-maybe-no-diagnostics.c
@@ -0,0 +1,106 @@
+// RUN: %clang_cc1 -DTEST_A1 -verify %s
+// RUN: %clang_cc1 -DTEST_B1 -verify %s
+// RUN: %clang_cc1 -DTEST_B2 -verify %s
+// RUN: %clang_cc1 -DTEST_C1 -verify %s
+// RUN: %clang_cc1 -DTEST_C2 -verify %s
+// RUN: not %clang_cc1 -DTEST_D1 -verify %s 2>&1 | FileCheck --check-prefix=D1-CHECK %s
+// RUN: not %clang_cc1 -DTEST_D2 -verify %s 2>&1 | FileCheck --check-prefix=D2-CHECK %s
+// RUN: not %clang_cc1 -DTEST_D3 -verify %s 2>&1 | FileCheck --check-prefix=D3-CHECK %s
+// RUN: not %clang_cc1 -DTEST_D4 -verify %s 2>&1 | FileCheck --check-prefix=D4-CHECK %s
+// RUN: not %clang_cc1 -DTEST_D5 -verify %s 2>&1 | FileCheck --check-prefix=D5-CHECK %s
+// RUN: not %clang_cc1 -DTEST_D6 -verify %s 2>&1 | FileCheck --check-prefix=D6-CHECK %s
+
+#ifdef TEST_A1
+// expected-maybe-no-diagnostics
+#endif
+
+#ifdef TEST_B1
+// expected-maybe-no-diagnostics
+// expected-no-diagnostics
+#endif
+
+#ifdef TEST_B2
+// expected-no-diagnostics
+// expected-maybe-no-diagnostics
+#endif
+
+#ifdef TEST_C1
+// expected-maybe-no-diagnostics
+#error test_c1
+// expected-error@-1 {{test_c1}}
+#endif
+
+#ifdef TEST_C2
+#error test_c2
+// expected-error@-1 {{test_c2}}
+// expected-maybe-no-diagnostics
+#endif
+
+#ifdef TEST_D1
+// expected-maybe-no-diagnostics
+#error test_d1
+// expected-error@-1 {{test_d1}}
+// expected-no-diagnostics
+
+//  D1-CHECK: error: 'error' diagnostics seen but not expected:
+// D1-CHECK-NEXT:   {{.*}} 'expected-no-diagnostics' directive cannot follow other expected directives
+// D1-CHECK-NEXT: 1 error generated.
+#endif
+
+#ifdef TEST_D2
+// expected-maybe-no-diagnostics
+// expected-no-diagnostics
+#error test_d2
+// expected-error@-1 {{test_d2}}
+
+//  D2-CHECK: error: 'error' diagnostics seen but not expected:
+// D2-CHECK-NEXT:   {{test_d2}}
+// D2-CHECK-NEXT:   {{.*}} expected directive cannot follow 'expected-no-diagnostics' directive
+// D2-CHECK-NEXT: 2 errors generated.
+#endif
+
+#ifdef TEST_D3
+// expected-no-diagnostics
+// expected-maybe-no-diagnostics
+#error test_d3
+// expected-error@-1 {{test_d3}}
+
+//  D3-CHECK: error: 'error' diagnostics seen but not expected:
+// D3-CHECK-NEXT:   {{test_d3}}
+// D3-CHECK-NEXT:   {{.*}} expected directive cannot follow 'expected-no-diagnostics' directive
+// D3-CHECK-NEXT: 2 errors generated.
+#endif
+
+#ifdef TEST_D4
+// expected-no-diagnostics
+#error test_d4
+// expected-error@-1 {{test_d4}}
+// expected-maybe-no-diagnostics
+
+//  D4-CHECK: error: 'error' diagnostics seen but not expected:
+// D4-CHECK-NEXT:   {{test_d4}}
+// D4-CHECK-NEXT:   {{.*}} expected directive cannot follow 'expected-no-diagnostics' directive
+// D4-CHECK-NEXT: 2 errors generated.
+#endif
+
+#ifdef TEST_D5
+#error test_d5
+// expected-error@-1 {{test_d5}}
+// expected-no-diagnostics
+// expected-maybe-no-diagnostics
+
+//  D5-CHECK: error: 'error' diagnostics seen but not expected:
+// D5-CHECK-NEXT:   {{.*}} 'expected-no-diagnostics' directive cannot follow other expected directives
+// D5-CHECK-NEXT: 1 error generated.
+#endif
+
+#ifdef TEST_D6
+#error test_d6
+// expected-error@-1 {{test_d6}}
+// expected-maybe-no-diagnostics
+// expected-no-diagnostics
+
+//  D6-CHECK: error: 'error' diagnostics seen but not expected:
+// D6-CHECK-NEXT:   {{.*}} 'expected-no-diagnostics' directive cannot follow other expected directives
+// D6-CHECK-NEXT: 1 error generated.
+#endif
Index: clang/lib/Frontend/VerifyDiagnosticConsumer.cpp
===
--- clang/lib/Frontend/VerifyDiagnosticConsumer.cpp
+++ clang/lib/Frontend/VerifyDiagnosticConsumer.cpp
@@ -462,7 +462,11 @@
   D.DL = ED ? &ED->Remarks : nullptr;
 else if (DToken.endswith(DType="-note"))
   D.DL = ED ? &ED->Notes : nullptr;
-else if (DToken.endswith(DType="-no-diagnostics")) {
+else if (DToken.endswith(DType="-maybe-no-diagnostics")) {
+  if (Status == Verify

[PATCH] D151042: [clang] Add tests for CWG issues 977, 1482, 2516

2023-05-23 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill added a comment.

In D151042#4364149 , @thakis wrote:

> In fact, you can probably repro the test failure on your linux box if you 
> change that test and add locally add -triple=i386-pc-win32 to the RUN line

You're right, MSVC-specific triple make the issue reproduce on my Linux box. 
Thank you!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151042/new/

https://reviews.llvm.org/D151042

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D151042: [clang] Add tests for CWG issues 977, 1482, 2516

2023-05-23 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill added a comment.

All tests pass for me on Linux.
As far as I understand, diagnostics on Windows are not supposed to be different 
given the same `-cc1` flags. Reverting for further investigation.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151042/new/

https://reviews.llvm.org/D151042

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D151042: [clang] Add tests for CWG issues 977, 1482, 2516

2023-05-23 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill added a comment.

In D151042#4364108 , @thakis wrote:

> This breaks check-clang on windows: http://45.33.8.238/win/78827/step_7.txt
>
> Please take a look and revert for now if it takes a while to fix.

It's not hard to fix, but is it just windows? Sorry I'm not too familiar with 
buildbots.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151042/new/

https://reviews.llvm.org/D151042

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D151166: [clangd] Interactive AST matchers with #pragma clang query

2023-05-23 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill added a comment.

This is an interesting feature!
There's a related `#pragma clang __debug dump`, that dumps name lookup result 
or a bit of AST for expression you pass to it 
(https://clang.llvm.org/docs/LanguageExtensions.html#debugging-the-compiler). I 
think clangd might be interested to support that pragma as well.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151166/new/

https://reviews.llvm.org/D151166

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D151042: [clang] Add tests for CWG issues 977, 1482, 2516

2023-05-23 Thread Vlad Serebrennikov via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG85452b5f9b5a: [clang] Add tests for CWG issues 977, 1482, 
2516 (authored by Endill).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151042/new/

https://reviews.llvm.org/D151042

Files:
  clang/test/CXX/drs/dr14xx.cpp
  clang/test/CXX/drs/dr25xx.cpp
  clang/test/CXX/drs/dr9xx.cpp
  clang/www/cxx_dr_status.html


Index: clang/www/cxx_dr_status.html
===
--- clang/www/cxx_dr_status.html
+++ clang/www/cxx_dr_status.html
@@ -5669,7 +5669,7 @@
 https://cplusplus.github.io/CWG/issues/977.html";>977
 CD3
 When is an enumeration type complete?
-Unknown
+Yes
   
   
 https://cplusplus.github.io/CWG/issues/978.html";>978
@@ -8699,7 +8699,7 @@
 https://cplusplus.github.io/CWG/issues/1482.html";>1482
 CD3
 Point of declaration of enumeration
-Unknown
+Yes
   
   
 https://cplusplus.github.io/CWG/issues/1483.html";>1483
@@ -14903,7 +14903,7 @@
 https://cplusplus.github.io/CWG/issues/2516.html";>2516
 DR
 Locus of enum-specifier or opaque-enum-declaration
-Unknown
+Yes
   
   
 https://cplusplus.github.io/CWG/issues/2517.html";>2517
Index: clang/test/CXX/drs/dr9xx.cpp
===
--- clang/test/CXX/drs/dr9xx.cpp
+++ clang/test/CXX/drs/dr9xx.cpp
@@ -90,6 +90,17 @@
 #endif
 }
 
+namespace dr977 { // dr977: yes
+enum E { e = E() };
+// expected-error@-1 {{invalid use of incomplete type 'E'}}
+// expected-note@-2 {{definition of 'dr977::E' is not complete until the 
closing '}'}}
+#if __cplusplus >= 201103L
+enum E2 : int { e2 = E2() };
+enum struct E3 { e = static_cast(E3()) };
+enum struct E4 : int { e = static_cast(E4()) };
+#endif
+} // namespace dr977
+
 namespace dr990 { // dr990: 3.5
 #if __cplusplus >= 201103L
   struct A { // expected-note 2{{candidate}}
Index: clang/test/CXX/drs/dr25xx.cpp
===
--- clang/test/CXX/drs/dr25xx.cpp
+++ clang/test/CXX/drs/dr25xx.cpp
@@ -1,5 +1,16 @@
 // RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-unknown %s -verify
 
+namespace dr2516 { // dr2516: yes
+   // NB: reusing 1482 test
+#if __cplusplus >= 201103L
+template  struct S {
+  typedef char I;
+};
+enum E2 : S::I { e };
+// expected-error@-1 {{use of undeclared identifier 'E2'}}
+#endif
+} // namespace dr2516
+
 namespace dr2518 { // dr2518: 17
 
 template 
Index: clang/test/CXX/drs/dr14xx.cpp
===
--- clang/test/CXX/drs/dr14xx.cpp
+++ clang/test/CXX/drs/dr14xx.cpp
@@ -488,6 +488,17 @@
   int operator"" _a(const char*, std::size_t = 0); // expected-error {{literal 
operator cannot have a default argument}}
 }
 
+namespace dr1482 { // dr1482: yes
+   // NB: sup 2516, test reused there
+#if __cplusplus >= 201103L
+template  struct S {
+  typedef char I;
+};
+enum E2 : S::I { e };
+// expected-error@-1 {{use of undeclared identifier 'E2'}}
+#endif
+} // namespace dr1482
+
 namespace dr1490 {  // dr1490: 3.7 c++11
   // List-initialization from a string literal
 


Index: clang/www/cxx_dr_status.html
===
--- clang/www/cxx_dr_status.html
+++ clang/www/cxx_dr_status.html
@@ -5669,7 +5669,7 @@
 https://cplusplus.github.io/CWG/issues/977.html";>977
 CD3
 When is an enumeration type complete?
-Unknown
+Yes
   
   
 https://cplusplus.github.io/CWG/issues/978.html";>978
@@ -8699,7 +8699,7 @@
 https://cplusplus.github.io/CWG/issues/1482.html";>1482
 CD3
 Point of declaration of enumeration
-Unknown
+Yes
   
   
 https://cplusplus.github.io/CWG/issues/1483.html";>1483
@@ -14903,7 +14903,7 @@
 https://cplusplus.github.io/CWG/issues/2516.html";>2516
 DR
 Locus of enum-specifier or opaque-enum-declaration
-Unknown
+Yes
   
   
 https://cplusplus.github.io/CWG/issues/2517.html";>2517
Index: clang/test/CXX/drs/dr9xx.cpp
===
--- clang/test/CXX/drs/dr9xx.cpp
+++ clang/test/CXX/drs/dr9xx.cpp
@@ -90,6 +90,17 @@
 #endif
 }
 
+namespace dr977 { // dr977: yes
+enum E { e = E() };
+// expected-error@-1 {{invalid use of incomplete type 'E'}}
+// expected-note@-2 {{definition of 'dr977::E' is not complete until the closing '}'}}
+#if __cplusplus >= 201103L
+enum E2 : int { e2 = E2() };
+enum struct E3 { e = static_cast(E3()) };
+enum struct E4 : int { e = static_cast(E4()) };
+#endif
+} // namespace dr977
+
 namespace dr990 { // dr990: 3.5
 #if __cplusplus >= 201103L
   struct A { // expected-note 2{{candidate}}
Index: clang/test/CXX/drs/dr25xx.cpp
===
--- cl

[PATCH] D151032: [clang] Add test for CWG2213

2023-05-23 Thread Vlad Serebrennikov via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG71bc3dd42e29: [clang] Add test for CWG2213 (authored by 
Endill).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151032/new/

https://reviews.llvm.org/D151032

Files:
  clang/test/CXX/drs/dr22xx.cpp
  clang/www/cxx_dr_status.html


Index: clang/www/cxx_dr_status.html
===
--- clang/www/cxx_dr_status.html
+++ clang/www/cxx_dr_status.html
@@ -13085,7 +13085,7 @@
 https://cplusplus.github.io/CWG/issues/2213.html";>2213
 CD6
 Forward declaration of partial specializations
-Unknown
+Yes
   
   
 https://cplusplus.github.io/CWG/issues/2214.html";>2214
Index: clang/test/CXX/drs/dr22xx.cpp
===
--- clang/test/CXX/drs/dr22xx.cpp
+++ clang/test/CXX/drs/dr22xx.cpp
@@ -14,6 +14,14 @@
 }
 #endif
 
+namespace dr2213 { // dr2213: yes
+template 
+struct A;
+
+template 
+struct A;
+} // namespace dr2213
+
 namespace dr2229 { // dr2229: 7
 struct AnonBitfieldQualifiers {
   const unsigned : 1; // expected-error {{anonymous bit-field cannot have 
qualifiers}}


Index: clang/www/cxx_dr_status.html
===
--- clang/www/cxx_dr_status.html
+++ clang/www/cxx_dr_status.html
@@ -13085,7 +13085,7 @@
 https://cplusplus.github.io/CWG/issues/2213.html";>2213
 CD6
 Forward declaration of partial specializations
-Unknown
+Yes
   
   
 https://cplusplus.github.io/CWG/issues/2214.html";>2214
Index: clang/test/CXX/drs/dr22xx.cpp
===
--- clang/test/CXX/drs/dr22xx.cpp
+++ clang/test/CXX/drs/dr22xx.cpp
@@ -14,6 +14,14 @@
 }
 #endif
 
+namespace dr2213 { // dr2213: yes
+template 
+struct A;
+
+template 
+struct A;
+} // namespace dr2213
+
 namespace dr2229 { // dr2229: 7
 struct AnonBitfieldQualifiers {
   const unsigned : 1; // expected-error {{anonymous bit-field cannot have qualifiers}}
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D151034: [clang] Add test for CWG1397

2023-05-22 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill added a comment.

Thank you for the review!




Comment at: clang/test/CXX/drs/dr13xx.cpp:488
+#if __cplusplus == 201103L
+  // expected-error@#dr1397-struct-A {{default member initializer for 'p' 
needed within definition of enclosing class 'A' outside of member functions}}
+  // expected-note@#dr1397-void-p {{in evaluation of exception specification 
for 'dr1397::A::A' needed here}}

shafik wrote:
> These diagnostic are pretty bad, maybe provide a comment above explaining 
> them a little better or maybe better refactor the diagnostic?
Totally agree about diagnostic not being accessible. I filed [[ 
https://github.com/compiler-explorer/infra/blob/fa7c4cf145898d989cb3a33e49f2a1223107eeac/bin/yaml/cpp.yaml#L648
 | a bug]] for that, but not sure how to refactor it.

I don't think it's a good place to explain complicated diagnostic messages, 
though. If someone is interested enough, intent could be seen on this review 
and in CWG1397 itself. We better just fix the diagnostic, and expected message 
together with it.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151034/new/

https://reviews.llvm.org/D151034

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D151042: [clang] Add tests for CWG issues 977, 1482, 2516

2023-05-20 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill created this revision.
Endill added reviewers: clang-language-wg, shafik.
Herald added a project: All.
Endill requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

CWG977 focus on point of /completeness/ of enums. Wording provided in CWG1482.
CWG1482 and CWG2516 focus on locus (point) of /declaration/. Wording provided 
in CWG2516.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D151042

Files:
  clang/test/CXX/drs/dr14xx.cpp
  clang/test/CXX/drs/dr25xx.cpp
  clang/test/CXX/drs/dr9xx.cpp
  clang/www/cxx_dr_status.html


Index: clang/www/cxx_dr_status.html
===
--- clang/www/cxx_dr_status.html
+++ clang/www/cxx_dr_status.html
@@ -5669,7 +5669,7 @@
 https://cplusplus.github.io/CWG/issues/977.html";>977
 CD3
 When is an enumeration type complete?
-Unknown
+Yes
   
   
 https://cplusplus.github.io/CWG/issues/978.html";>978
@@ -8699,7 +8699,7 @@
 https://cplusplus.github.io/CWG/issues/1482.html";>1482
 CD3
 Point of declaration of enumeration
-Unknown
+Yes
   
   
 https://cplusplus.github.io/CWG/issues/1483.html";>1483
@@ -14903,7 +14903,7 @@
 https://cplusplus.github.io/CWG/issues/2516.html";>2516
 DR
 Locus of enum-specifier or opaque-enum-declaration
-Unknown
+Yes
   
   
 https://cplusplus.github.io/CWG/issues/2517.html";>2517
Index: clang/test/CXX/drs/dr9xx.cpp
===
--- clang/test/CXX/drs/dr9xx.cpp
+++ clang/test/CXX/drs/dr9xx.cpp
@@ -90,6 +90,17 @@
 #endif
 }
 
+namespace dr977 { // dr977: yes
+enum E { e = E() };
+// expected-error@-1 {{invalid use of incomplete type 'E'}}
+// expected-note@-2 {{definition of 'dr977::E' is not complete until the 
closing '}'}}
+#if __cplusplus >= 201103L
+enum E2 : int { e2 = E2() };
+enum struct E3 { e = static_cast(E3()) };
+enum struct E4 : int { e = static_cast(E4()) };
+#endif
+} // namespace dr977
+
 namespace dr990 { // dr990: 3.5
 #if __cplusplus >= 201103L
   struct A { // expected-note 2{{candidate}}
Index: clang/test/CXX/drs/dr25xx.cpp
===
--- clang/test/CXX/drs/dr25xx.cpp
+++ clang/test/CXX/drs/dr25xx.cpp
@@ -1,5 +1,16 @@
 // RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-unknown %s -verify
 
+namespace dr2516 { // dr2516: yes
+   // NB: reusing 1482 test
+#if __cplusplus >= 201103L
+template  struct S {
+  typedef char I;
+};
+enum E2 : S::I { e };
+// expected-error@-1 {{use of undeclared identifier 'E2'}}
+#endif
+} // namespace dr2516
+
 namespace dr2518 { // dr2518: 17
 
 template 
Index: clang/test/CXX/drs/dr14xx.cpp
===
--- clang/test/CXX/drs/dr14xx.cpp
+++ clang/test/CXX/drs/dr14xx.cpp
@@ -488,6 +488,17 @@
   int operator"" _a(const char*, std::size_t = 0); // expected-error {{literal 
operator cannot have a default argument}}
 }
 
+namespace dr1482 { // dr1482: yes
+   // NB: sup 2516, test reused there
+#if __cplusplus >= 201103L
+template  struct S {
+  typedef char I;
+};
+enum E2 : S::I { e };
+// expected-error@-1 {{use of undeclared identifier 'E2'}}
+#endif
+} // namespace dr1482
+
 namespace dr1490 {  // dr1490: 3.7 c++11
   // List-initialization from a string literal
 


Index: clang/www/cxx_dr_status.html
===
--- clang/www/cxx_dr_status.html
+++ clang/www/cxx_dr_status.html
@@ -5669,7 +5669,7 @@
 https://cplusplus.github.io/CWG/issues/977.html";>977
 CD3
 When is an enumeration type complete?
-Unknown
+Yes
   
   
 https://cplusplus.github.io/CWG/issues/978.html";>978
@@ -8699,7 +8699,7 @@
 https://cplusplus.github.io/CWG/issues/1482.html";>1482
 CD3
 Point of declaration of enumeration
-Unknown
+Yes
   
   
 https://cplusplus.github.io/CWG/issues/1483.html";>1483
@@ -14903,7 +14903,7 @@
 https://cplusplus.github.io/CWG/issues/2516.html";>2516
 DR
 Locus of enum-specifier or opaque-enum-declaration
-Unknown
+Yes
   
   
 https://cplusplus.github.io/CWG/issues/2517.html";>2517
Index: clang/test/CXX/drs/dr9xx.cpp
===
--- clang/test/CXX/drs/dr9xx.cpp
+++ clang/test/CXX/drs/dr9xx.cpp
@@ -90,6 +90,17 @@
 #endif
 }
 
+namespace dr977 { // dr977: yes
+enum E { e = E() };
+// expected-error@-1 {{invalid use of incomplete type 'E'}}
+// expected-note@-2 {{definition of 'dr977::E' is not complete until the closing '}'}}
+#if __cplusplus >= 201103L
+enum E2 : int { e2 = E2() };
+enum struct E3 { e = static_cast(E3()) };
+enum struct E4 : int { e = static_cast(E4()) };
+#endif
+} // namespace dr977
+
 namespace dr990 { // dr990: 3.5
 #if __cplusplus >= 201103L
   struct A { // expected-note 2{{candidate}}
Index: clang/test/

[PATCH] D151034: [clang] Add test for CWG1397

2023-05-20 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill created this revision.
Endill added reviewers: clang-language-wg, shafik.
Herald added a project: All.
Endill requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Resolution of this CWG breaks potential dependency loop between complete-class 
context of non-static data member initializer (NSDMI), and defaulted default 
constructor, which is `noexcept` depending on NSDMIs among other things.

For whatever reason in C++11 mode we issue an additional note and a different 
line number for the primary error. But I find the message itself even worse 
than aforementioned issues. It describes what's going on, but doesn't say 
what's bad about it. I find the previous version of this message more clear: 
https://github.com/llvm/llvm-project/commit/8dbc6b26171167b8ddf66a5f4b6d6fb9baf28336


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D151034

Files:
  clang/test/CXX/drs/dr13xx.cpp
  clang/www/cxx_dr_status.html


Index: clang/www/cxx_dr_status.html
===
--- clang/www/cxx_dr_status.html
+++ clang/www/cxx_dr_status.html
@@ -8189,7 +8189,7 @@
 https://cplusplus.github.io/CWG/issues/1397.html";>1397
 CD4
 Class completeness in non-static data member initializers
-Unknown
+Clang 3.2
   
   
 https://cplusplus.github.io/CWG/issues/1398.html";>1398
Index: clang/test/CXX/drs/dr13xx.cpp
===
--- clang/test/CXX/drs/dr13xx.cpp
+++ clang/test/CXX/drs/dr13xx.cpp
@@ -480,6 +480,23 @@
 #endif
 }
 
+namespace dr1397 { // dr1397: 3.2
+#if __cplusplus >= 201103L
+struct A {   // #dr1397-struct-A
+  void *p = A{}; // #dr1397-void-p
+#if __cplusplus == 201103L
+  // expected-error@#dr1397-struct-A {{default member initializer for 'p' 
needed within definition of enclosing class 'A' outside of member functions}}
+  // expected-note@#dr1397-void-p {{in evaluation of exception specification 
for 'dr1397::A::A' needed here}}
+  // expected-note@#dr1397-void-p {{default member initializer declared here}}
+#elif __cplusplus >= 201402L
+  // expected-error@#dr1397-void-p {{default member initializer for 'p' needed 
within definition of enclosing class 'A' outside of member functions}}
+  // expected-note@#dr1397-void-p {{default member initializer declared here}}
+#endif
+  operator void*() const { return nullptr; }
+};
+#endif
+} // namespace dr1397
+
 namespace dr1399 { // dr1399: dup 1388
   template void f(T..., int, T...) {} // expected-note 
{{candidate}} expected-error 0-1{{C++11}}
   void g() {


Index: clang/www/cxx_dr_status.html
===
--- clang/www/cxx_dr_status.html
+++ clang/www/cxx_dr_status.html
@@ -8189,7 +8189,7 @@
 https://cplusplus.github.io/CWG/issues/1397.html";>1397
 CD4
 Class completeness in non-static data member initializers
-Unknown
+Clang 3.2
   
   
 https://cplusplus.github.io/CWG/issues/1398.html";>1398
Index: clang/test/CXX/drs/dr13xx.cpp
===
--- clang/test/CXX/drs/dr13xx.cpp
+++ clang/test/CXX/drs/dr13xx.cpp
@@ -480,6 +480,23 @@
 #endif
 }
 
+namespace dr1397 { // dr1397: 3.2
+#if __cplusplus >= 201103L
+struct A {   // #dr1397-struct-A
+  void *p = A{}; // #dr1397-void-p
+#if __cplusplus == 201103L
+  // expected-error@#dr1397-struct-A {{default member initializer for 'p' needed within definition of enclosing class 'A' outside of member functions}}
+  // expected-note@#dr1397-void-p {{in evaluation of exception specification for 'dr1397::A::A' needed here}}
+  // expected-note@#dr1397-void-p {{default member initializer declared here}}
+#elif __cplusplus >= 201402L
+  // expected-error@#dr1397-void-p {{default member initializer for 'p' needed within definition of enclosing class 'A' outside of member functions}}
+  // expected-note@#dr1397-void-p {{default member initializer declared here}}
+#endif
+  operator void*() const { return nullptr; }
+};
+#endif
+} // namespace dr1397
+
 namespace dr1399 { // dr1399: dup 1388
   template void f(T..., int, T...) {} // expected-note {{candidate}} expected-error 0-1{{C++11}}
   void g() {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D151032: [clang] Add test for CWG2213

2023-05-20 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill added a comment.

If reviewers would prefer this to be simply marked N/A, I'm not going to 
oppose. I wrote a test for this because it was simple enough.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151032/new/

https://reviews.llvm.org/D151032

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D151032: [clang] Add test for CWG2213

2023-05-20 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill created this revision.
Endill added reviewers: clang-language-wg, shafik, cor3ntin.
Herald added a project: All.
Endill requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

P1787 : CWG2213 is resolved by allowing an 
elaborated-type-specifier to contain a simple-template-id without friend.
Wording: see changes to [dcl.type.elab]]/1.

The gist of the issue is that forward declaration of partial class template 
specialization was disallowed.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D151032

Files:
  clang/test/CXX/drs/dr22xx.cpp
  clang/www/cxx_dr_status.html


Index: clang/www/cxx_dr_status.html
===
--- clang/www/cxx_dr_status.html
+++ clang/www/cxx_dr_status.html
@@ -13085,7 +13085,7 @@
 https://cplusplus.github.io/CWG/issues/2213.html";>2213
 CD6
 Forward declaration of partial specializations
-Unknown
+Yes
   
   
 https://cplusplus.github.io/CWG/issues/2214.html";>2214
Index: clang/test/CXX/drs/dr22xx.cpp
===
--- clang/test/CXX/drs/dr22xx.cpp
+++ clang/test/CXX/drs/dr22xx.cpp
@@ -14,6 +14,14 @@
 }
 #endif
 
+namespace dr2213 { // dr2213: yes
+template 
+struct A;
+
+template 
+struct A;
+} // namespace dr2213
+
 namespace dr2229 { // dr2229: 7
 struct AnonBitfieldQualifiers {
   const unsigned : 1; // expected-error {{anonymous bit-field cannot have 
qualifiers}}


Index: clang/www/cxx_dr_status.html
===
--- clang/www/cxx_dr_status.html
+++ clang/www/cxx_dr_status.html
@@ -13085,7 +13085,7 @@
 https://cplusplus.github.io/CWG/issues/2213.html";>2213
 CD6
 Forward declaration of partial specializations
-Unknown
+Yes
   
   
 https://cplusplus.github.io/CWG/issues/2214.html";>2214
Index: clang/test/CXX/drs/dr22xx.cpp
===
--- clang/test/CXX/drs/dr22xx.cpp
+++ clang/test/CXX/drs/dr22xx.cpp
@@ -14,6 +14,14 @@
 }
 #endif
 
+namespace dr2213 { // dr2213: yes
+template 
+struct A;
+
+template 
+struct A;
+} // namespace dr2213
+
 namespace dr2229 { // dr2229: 7
 struct AnonBitfieldQualifiers {
   const unsigned : 1; // expected-error {{anonymous bit-field cannot have qualifiers}}
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D140828: [C++] Implement "Deducing this" (P0847R7)

2023-05-20 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill added a comment.

Thank you for working on this feature!
I can't review this properly, so here's my little help for the feature I'm 
looking forward to very much.




Comment at: clang/test/CXX/drs/dr25xx.cpp:1
-// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-unknown %s -verify
+// RUN: %clang_cc1 -std=c++20 -Wno-c++2b-extensions -triple 
x86_64-unknown-unknown %s -verify
+// RUN: %clang_cc1 -std=c++2b -triple x86_64-unknown-unknown %s -verify

Better get C++23-specific tests under `#ifdef __cplusplus >= 202302L`, because 
compiler options have more global effect. 



Comment at: clang/test/CXX/drs/dr25xx.cpp:2
+// RUN: %clang_cc1 -std=c++20 -Wno-c++2b-extensions -triple 
x86_64-unknown-unknown %s -verify
+// RUN: %clang_cc1 -std=c++2b -triple x86_64-unknown-unknown %s -verify
+

`c++23` mode is available now, and Erich converted all `c++2b` to `c++23` 
across DR tests (at least). I think you also need a RUN line for `c++2c` mode 
now.



Comment at: clang/test/CXX/drs/dr25xx.cpp:4
+
+namespace dr2553 { // dr2553: 16 open
+struct B {

Please, don't forget to update the version before landing. Spotting this 
retroactively could be difficult.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140828/new/

https://reviews.llvm.org/D140828

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D147920: [clang] Add test for CWG399

2023-05-20 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill added a comment.

Should be fixed by 
https://github.com/llvm/llvm-project/commit/abbb22cc0c9c33dedb8d53c2bd3e703f92baace7.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D147920/new/

https://reviews.llvm.org/D147920

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D147920: [clang] Add test for CWG399

2023-05-20 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill added a comment.

Thank you!
I'm going to fix this now.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D147920/new/

https://reviews.llvm.org/D147920

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D147920: [clang] Add test for CWG399

2023-05-20 Thread Vlad Serebrennikov via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Endill marked an inline comment as not done.
Closed by commit rG14f245d01a1e: [clang] Add test for CWG399 (authored by 
Endill).

Changed prior to commit:
  https://reviews.llvm.org/D147920?vs=512094&id=523999#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D147920/new/

https://reviews.llvm.org/D147920

Files:
  clang/test/CXX/drs/dr2xx.cpp
  clang/test/CXX/drs/dr3xx.cpp
  clang/www/cxx_dr_status.html

Index: clang/www/cxx_dr_status.html
===
--- clang/www/cxx_dr_status.html
+++ clang/www/cxx_dr_status.html
@@ -2433,7 +2433,7 @@
 https://cplusplus.github.io/CWG/issues/399.html";>399
 CD6
 Destructor lookup redux
-Unknown
+Clang 11
   
   
 https://cplusplus.github.io/CWG/issues/400.html";>400
Index: clang/test/CXX/drs/dr3xx.cpp
===
--- clang/test/CXX/drs/dr3xx.cpp
+++ clang/test/CXX/drs/dr3xx.cpp
@@ -1435,3 +1435,83 @@
 }
   }
 }
+
+namespace dr399 { // dr399: 11
+  // NB: reuse dr244 test 
+  struct B {}; // expected-note {{type 'dr244::B' found by destructor name lookup}}
+  struct D : B {};
+
+  D D_object;
+  typedef B B_alias;
+  B* B_ptr = &D_object;
+
+  void f() {
+D_object.~B(); // expected-error {{does not match the type 'D' of the object being destroyed}}
+D_object.B::~B();
+D_object.D::~B(); // FIXME: Missing diagnostic for this.
+B_ptr->~B();
+B_ptr->~B_alias();
+B_ptr->B_alias::~B();
+B_ptr->B_alias::~B_alias();
+B_ptr->dr244::~B(); // expected-error {{refers to a member in namespace}}
+B_ptr->dr244::~B_alias(); // expected-error {{refers to a member in namespace}}
+  }
+
+  template
+  void f(T *B_ptr, U D_object) {
+D_object.~B(); // FIXME: Missing diagnostic for this.
+D_object.B::~B();
+D_object.D::~B(); // FIXME: Missing diagnostic for this.
+B_ptr->~B();
+B_ptr->~B_alias();
+B_ptr->B_alias::~B();
+B_ptr->B_alias::~B_alias();
+B_ptr->dr399::~B(); // expected-error {{does not refer to a type name}}
+B_ptr->dr399::~B_alias(); // expected-error {{does not refer to a type name}}
+  }
+  template void f(B*, D);
+
+  namespace N {
+template struct E {};
+typedef E F;
+  }
+  void g(N::F f) {
+typedef N::F G; // expected-note {{found by destructor name lookup}}
+f.~G();
+f.G::~E(); // expected-error {{ISO C++ requires the name after '::~' to be found in the same scope as the name before '::~'}}
+f.G::~F(); // expected-error {{undeclared identifier 'F' in destructor name}}
+f.G::~G();
+// This is technically ill-formed; E is looked up in 'N::' and names the
+// class template, not the injected-class-name of the class. But that's
+// probably a bug in the standard.
+f.N::F::~E(); // expected-error {{ISO C++ requires the name after '::~' to be found in the same scope as the name before '::~'}}
+// This is valid; we look up the second F in the same scope in which we
+// found the first one, that is, 'N::'.
+f.N::F::~F();
+// This is technically ill-formed; G is looked up in 'N::' and is not found.
+// Rejecting this seems correct, but most compilers accept, so we do also.
+f.N::F::~G(); // expected-error {{qualified destructor name only found in lexical scope; omit the qualifier to find this type name by unqualified lookup}}
+  }
+
+  // Bizarrely, compilers perform lookup in the scope for qualified destructor
+  // names, if the nested-name-specifier is non-dependent. Ensure we diagnose
+  // this.
+  namespace QualifiedLookupInScope {
+namespace N {
+  template  struct S { struct Inner {}; };
+}
+template  void f(typename N::S::Inner *p) {
+  typedef typename N::S::Inner T;
+  p->::dr399::QualifiedLookupInScope::N::S::Inner::~T(); // expected-error {{no type named 'T' in}}
+}
+template void f(N::S::Inner *); // expected-note {{instantiation of}}
+
+template  void g(U *p) {
+  typedef U T;
+  p->T::~T();
+  p->U::~T();
+  p->::dr399::QualifiedLookupInScope::N::S::Inner::~T(); // expected-error {{'T' does not refer to a type name}}
+}
+template void g(N::S::Inner *);
+  }
+}
Index: clang/test/CXX/drs/dr2xx.cpp
===
--- clang/test/CXX/drs/dr2xx.cpp
+++ clang/test/CXX/drs/dr2xx.cpp
@@ -500,6 +500,7 @@
 }
 
 namespace dr244 { // dr244: 11
+  // NB: this test is reused by dr399
   struct B {}; // expected-note {{type 'dr244::B' found by destructor name lookup}}
   struct D : B {};
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D147920: [clang] Add test for CWG399

2023-05-17 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill added a comment.

@shafik ping




Comment at: clang/test/CXX/drs/dr3xx.cpp:1439
+
+namespace dr399 { // dr399: 11
+  // NB: reuse dr244 test 

aaron.ballman wrote:
> aaron.ballman wrote:
> > shafik wrote:
> > > Endill wrote:
> > > > shafik wrote:
> > > > > Endill wrote:
> > > > > > Despite a couple of FIXME in CWG244 test (out of dozens of 
> > > > > > examples), it claims full availability since Clang 11. I'd take a 
> > > > > > more conservative approach, declaring partial support, but I think 
> > > > > > that declaring different availability for the same test would bring 
> > > > > > unnecessary confusion. So I followed CWG244 availability.
> > > > > > 
> > > > > > Alternative is to demote CWG244 to partial, but I'm not sure we 
> > > > > > should go back on our claims for CWG support that has been out for 
> > > > > > so long.
> > > > > I think the bugs are not awful, we should file bug reports if we 
> > > > > don't already have them. Some of them seem like they should be not 
> > > > > too bad to fix.
> > > > > 
> > > > > CC @aaron.ballman to get a second opinion
> > > > If we are to file bug reports, I'm not sure what wording makes those 
> > > > examples ill-formed. Is it [[ 
> > > > http://eel.is/c++draft/basic.lookup#qual.general-4.6 | qual.general-4.6 
> > > > ]]: `The type-name that is or contains Q shall refer to its (original) 
> > > > lookup context (ignoring cv-qualification) under the interpretation 
> > > > established by at least one (successful) lookup performed.`? I 
> > > > interpret it as requiring names to the left and to the right of `~` to 
> > > > be found in the same scope (lookup context; `namespace dr244` in our 
> > > > case). Could it actually mean that they have to refer to the same type?
> > > I am not sure maybe @rsmith might be able to help us here.
> > I think we want to start being more conservative with claiming support for 
> > features and DRs, and that means being more honest with "partial" markings 
> > (with comments as to WHY the support is only partial, what's still left to 
> > be done, etc). I don't think it's a problem to say "we've discovered enough 
> > issues with this that we no longer claim to support it" when that's 
> > accurate.
> > 
> > I don't think we have a hard and fast rule for when a bug is sufficiently 
> > worrying to merit partial vs full support; it's going to depend on the 
> > situation, I think. Failing to diagnose incorrect code is a different kind 
> > of problem from diagnosing correct code from crashing bugs from etc. and 
> > it's going to be up to the patch author and reviewers to make a value 
> > judgement. But that's why I think it's fine for us to update the status 
> > when we learn more information, too.
> > 
> > That said, when we do have partial support, we definitely need to file 
> > issues to address the remaining bits at some point.
> > 
> > > I interpret it as requiring names to the left and to the right of ~ to be 
> > > found in the same scope (lookup context; namespace dr244 in our case). 
> > > Could it actually mean that they have to refer to the same type?
> > 
> > I've read that wording a few times now and can't make heads or tails of 
> > what it's trying to say. Perhaps @rsmith or @hubert.reinterpretcast can 
> > help illuminate us?
> @Endill reminded me off-list that the FIXME comments here are existing 
> comments; some of these test cases are lifted from the dr244 test cases. 
> Given that and it's been a few weeks and we've not determine what issues to 
> file, I think we should unblock this review as it makes forward progress on 
> our test coverage for dr399. Filing issues would be good, but not a 
> prerequisite for landing this. WDYT @shafik?
> @Endill reminded me off-list that the FIXME comments here are existing 
> comments; some of these test cases are lifted from the dr244 test cases. 
> Given that and it's been a few weeks and we've not determine what issues to 
> file, I think we should unblock this review as it makes forward progress on 
> our test coverage for dr399. Filing issues would be good, but not a 
> prerequisite for landing this. WDYT @shafik?




Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D147920/new/

https://reviews.llvm.org/D147920

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D146654: [clang] replaces numeric SARIF ids with heirarchical names

2023-04-28 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill added inline comments.



Comment at: clang/lib/Frontend/SARIFDiagnostic.cpp:51-52
+  Diag->getDiags()->getDiagnosticIDs()->getStableName(Diag->getID()).str();
+  std::replace(StableName.begin(), StableName.end(), '_', '.');
+  SarifRule Rule = SarifRule::create().setRuleId(StableName);
 

vaibhav.y wrote:
> cjdb wrote:
> > denik wrote:
> > > §3.5.4 says that the hierarchical strings are separated by "/".
> > > 
> > > But more generally, are diagnostic names really fall under "hierarchical" 
> > > definition?
> > > Words between underscores should be treated as components. And $3.27.5 
> > > says that the leading components have to be the identifier of the rule.
> > > In some cases they look like valid components, e.g. `err_access`, 
> > > `err_access_dtor`, `err_access_dtor_exception`.
> > > But in cases like `err_cannot_open_file` neither of the leading 
> > > components exists.
> > > 
> > > Theoretically we could use groups as the leading component for warnings 
> > > for example. For errors the leading components are probably not even 
> > > necessary, since if I understood correctly they are needed to suppress 
> > > subsets of violations on the SARIF consumer side.
> > > Or we just could keep the names with underscores as is. WDYT?
> > I think in light of what you've said, changing back to underscores is 
> > probably best.
> > But more generally, are diagnostic names really fall under "hierarchical" 
> > definition?
> 
> I have the same concern, but this is okay for a first pass as a "flat 
> hierarchy" :)
> 
> If we want a deeper structure, we'll need some extra metadata in 
> `DiagnosticSemaKinds.td`'s `Error<...>`  to add cluster names as a follow up 
> to this.
> 
> WDYT about something like `clang/visibility/err_access` or 
> `clang/syntax/err_stmtexpr_file_scope`.
> 
> Alternatively: we could draw from the c++ standard structure: 
> https://eel.is/c++draft/basic.def.odr#term.odr.use and say the error code for 
> an ODR violation could be `clang/basic/def/odr`, again I'm unsure how well 
> this meshes with clang's diagnostic model.
> Alternatively: we could draw from the c++ standard structure: 
> https://eel.is/c++draft/basic.def.odr#term.odr.use and say the error code for 
> an ODR violation could be clang/basic/def/odr, again I'm unsure how well this 
> meshes with clang's diagnostic model.

The only reliable thing there are stable clause names like `[namespace.udecl]`, 
because there are precedents of them being rearranged in the table of contents 
([[ 
https://github.com/cplusplus/draft/commit/982a456f176ca00409c6e514af932051dce2485f
 | 1 ]], [[ 
https://github.com/cplusplus/draft/commit/3c580cd204fde95a21de1830ace75d14d429f845
 | 2 ]]). We've got bitten by that in C++ conformance tests, which use table of 
contents for directory hierarchy.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D146654/new/

https://reviews.llvm.org/D146654

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D149003: [clang] Add test for CWG1821

2023-04-24 Thread Vlad Serebrennikov via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG5cda0d165a75: [clang] Add test for CWG1821 (authored by 
Endill).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D149003/new/

https://reviews.llvm.org/D149003

Files:
  clang/test/CXX/drs/dr18xx.cpp
  clang/www/cxx_dr_status.html


Index: clang/www/cxx_dr_status.html
===
--- clang/www/cxx_dr_status.html
+++ clang/www/cxx_dr_status.html
@@ -10733,7 +10733,7 @@
 https://cplusplus.github.io/CWG/issues/1821.html";>1821
 CD6
 Qualified redeclarations in a class member-specification
-Unknown
+Yes
   
   
 https://cplusplus.github.io/CWG/issues/1822.html";>1822
Index: clang/test/CXX/drs/dr18xx.cpp
===
--- clang/test/CXX/drs/dr18xx.cpp
+++ clang/test/CXX/drs/dr18xx.cpp
@@ -51,6 +51,22 @@
 #endif
 }
 
+namespace dr1821 { // dr1821: yes
+struct A {
+  template  struct B {
+void f();
+  };
+  template  void B::f(){};
+  // expected-error@-1 {{non-friend class member 'f' cannot have a qualified 
name}}
+
+  struct C {
+void f();
+  };
+  void C::f() {}
+  // expected-error@-1 {{non-friend class member 'f' cannot have a qualified 
name}}
+};
+} // namespace dr1821
+
 namespace dr1822 { // dr1822: yes
 #if __cplusplus >= 201103L
   int a;


Index: clang/www/cxx_dr_status.html
===
--- clang/www/cxx_dr_status.html
+++ clang/www/cxx_dr_status.html
@@ -10733,7 +10733,7 @@
 https://cplusplus.github.io/CWG/issues/1821.html";>1821
 CD6
 Qualified redeclarations in a class member-specification
-Unknown
+Yes
   
   
 https://cplusplus.github.io/CWG/issues/1822.html";>1822
Index: clang/test/CXX/drs/dr18xx.cpp
===
--- clang/test/CXX/drs/dr18xx.cpp
+++ clang/test/CXX/drs/dr18xx.cpp
@@ -51,6 +51,22 @@
 #endif
 }
 
+namespace dr1821 { // dr1821: yes
+struct A {
+  template  struct B {
+void f();
+  };
+  template  void B::f(){};
+  // expected-error@-1 {{non-friend class member 'f' cannot have a qualified name}}
+
+  struct C {
+void f();
+  };
+  void C::f() {}
+  // expected-error@-1 {{non-friend class member 'f' cannot have a qualified name}}
+};
+} // namespace dr1821
+
 namespace dr1822 { // dr1822: yes
 #if __cplusplus >= 201103L
   int a;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D148263: [clang] Mark CWG2009 as N/A

2023-04-24 Thread Vlad Serebrennikov via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG0a113c4c50f6: [clang] Mark CWG2009 as N/A (authored by 
Endill).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D148263/new/

https://reviews.llvm.org/D148263

Files:
  clang/test/CXX/drs/dr20xx.cpp
  clang/www/cxx_dr_status.html


Index: clang/www/cxx_dr_status.html
===
--- clang/www/cxx_dr_status.html
+++ clang/www/cxx_dr_status.html
@@ -11861,7 +11861,7 @@
 https://cplusplus.github.io/CWG/issues/2009.html";>2009
 CD6
 Unclear specification of class scope
-Unknown
+N/A
   
   
 https://cplusplus.github.io/CWG/issues/2010.html";>2010
Index: clang/test/CXX/drs/dr20xx.cpp
===
--- clang/test/CXX/drs/dr20xx.cpp
+++ clang/test/CXX/drs/dr20xx.cpp
@@ -19,6 +19,8 @@
 int b = __builtin_addressof(b2)->foo; // expected-error {{no member}}
 }
 
+// dr2009: na
+
 namespace dr2026 { // dr2026: 11
   template struct X {};
 


Index: clang/www/cxx_dr_status.html
===
--- clang/www/cxx_dr_status.html
+++ clang/www/cxx_dr_status.html
@@ -11861,7 +11861,7 @@
 https://cplusplus.github.io/CWG/issues/2009.html";>2009
 CD6
 Unclear specification of class scope
-Unknown
+N/A
   
   
 https://cplusplus.github.io/CWG/issues/2010.html";>2010
Index: clang/test/CXX/drs/dr20xx.cpp
===
--- clang/test/CXX/drs/dr20xx.cpp
+++ clang/test/CXX/drs/dr20xx.cpp
@@ -19,6 +19,8 @@
 int b = __builtin_addressof(b2)->foo; // expected-error {{no member}}
 }
 
+// dr2009: na
+
 namespace dr2026 { // dr2026: 11
   template struct X {};
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D149003: [clang] Add test for CWG1821

2023-04-22 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill created this revision.
Endill added reviewers: shafik, clang-language-wg.
Herald added a project: All.
Endill requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

P1787 : My clarification in “Where can namespace-scope 
functions and variables be redeclared?” 
 is applied, resolving CWG1821.
Wording: (If the declaration is not a friend declaration:) If the id-expression 
in a declarator-id is a qualified-id Q, let S be its lookup context; the 
declaration shall inhabit a namespace scope. ([dcl.meaning]/1)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D149003

Files:
  clang/test/CXX/drs/dr18xx.cpp
  clang/www/cxx_dr_status.html


Index: clang/www/cxx_dr_status.html
===
--- clang/www/cxx_dr_status.html
+++ clang/www/cxx_dr_status.html
@@ -10733,7 +10733,7 @@
 https://cplusplus.github.io/CWG/issues/1821.html";>1821
 CD6
 Qualified redeclarations in a class member-specification
-Unknown
+Yes
   
   
 https://cplusplus.github.io/CWG/issues/1822.html";>1822
Index: clang/test/CXX/drs/dr18xx.cpp
===
--- clang/test/CXX/drs/dr18xx.cpp
+++ clang/test/CXX/drs/dr18xx.cpp
@@ -51,6 +51,22 @@
 #endif
 }
 
+namespace dr1821 { // dr1821: yes
+struct A {
+  template  struct B {
+void f();
+  };
+  template  void B::f(){};
+  // expected-error@-1 {{non-friend class member 'f' cannot have a qualified 
name}}
+
+  struct C {
+void f();
+  };
+  void C::f() {}
+  // expected-error@-1 {{non-friend class member 'f' cannot have a qualified 
name}}
+};
+} // namespace dr1821
+
 namespace dr1822 { // dr1822: yes
 #if __cplusplus >= 201103L
   int a;


Index: clang/www/cxx_dr_status.html
===
--- clang/www/cxx_dr_status.html
+++ clang/www/cxx_dr_status.html
@@ -10733,7 +10733,7 @@
 https://cplusplus.github.io/CWG/issues/1821.html";>1821
 CD6
 Qualified redeclarations in a class member-specification
-Unknown
+Yes
   
   
 https://cplusplus.github.io/CWG/issues/1822.html";>1822
Index: clang/test/CXX/drs/dr18xx.cpp
===
--- clang/test/CXX/drs/dr18xx.cpp
+++ clang/test/CXX/drs/dr18xx.cpp
@@ -51,6 +51,22 @@
 #endif
 }
 
+namespace dr1821 { // dr1821: yes
+struct A {
+  template  struct B {
+void f();
+  };
+  template  void B::f(){};
+  // expected-error@-1 {{non-friend class member 'f' cannot have a qualified name}}
+
+  struct C {
+void f();
+  };
+  void C::f() {}
+  // expected-error@-1 {{non-friend class member 'f' cannot have a qualified name}}
+};
+} // namespace dr1821
+
 namespace dr1822 { // dr1822: yes
 #if __cplusplus >= 201103L
   int a;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D147920: [clang] Add test for CWG399

2023-04-19 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill added a comment.

@aaron.ballman ping


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D147920/new/

https://reviews.llvm.org/D147920

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D148433: [clang] Add tests for DRs about complete-class context

2023-04-17 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill updated this revision to Diff 514353.
Endill added a comment.

Weaken the FIXME wording per Shafik's suggestion


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D148433/new/

https://reviews.llvm.org/D148433

Files:
  clang/test/CXX/drs/dr13xx.cpp
  clang/test/CXX/drs/dr16xx.cpp
  clang/test/CXX/drs/dr18xx.cpp
  clang/test/CXX/drs/dr23xx.cpp
  clang/www/cxx_dr_status.html

Index: clang/www/cxx_dr_status.html
===
--- clang/www/cxx_dr_status.html
+++ clang/www/cxx_dr_status.html
@@ -2661,7 +2661,7 @@
 https://cplusplus.github.io/CWG/issues/437.html";>437
 CD1
 Is type of class allowed in member function exception specification?
-Superseded by 1308
+Superseded by 1308
   
   
 https://cplusplus.github.io/CWG/issues/438.html";>438
@@ -7655,7 +7655,7 @@
 https://cplusplus.github.io/CWG/issues/1308.html";>1308
 CD3
 Completeness of class type within an exception-specification
-Unknown
+Superseded by 1330
   
   
 https://cplusplus.github.io/CWG/issues/1309.html";>1309
@@ -9563,7 +9563,7 @@
 https://cplusplus.github.io/CWG/issues/1626.html";>1626
 open
 constexpr member functions in brace-or-equal-initializers
-Not resolved
+No
   
   
 https://cplusplus.github.io/CWG/issues/1627.html";>1627
@@ -11147,7 +11147,7 @@
 https://cplusplus.github.io/CWG/issues/1890.html";>1890
 drafting
 Member type depending on definition of member function
-Not resolved
+No
   
   
 https://cplusplus.github.io/CWG/issues/1891.html";>1891
@@ -13817,7 +13817,7 @@
 https://cplusplus.github.io/CWG/issues/2335.html";>2335
 drafting
 Deduced return types vs member types
-Not resolved
+No
   
   
 https://cplusplus.github.io/CWG/issues/2336.html";>2336
Index: clang/test/CXX/drs/dr23xx.cpp
===
--- clang/test/CXX/drs/dr23xx.cpp
+++ clang/test/CXX/drs/dr23xx.cpp
@@ -39,6 +39,43 @@
 
 // dr2331: na
 
+namespace dr2335 { // dr2335: no drafting
+// FIXME: current consensus is that the examples are well-formed.
+#if __cplusplus >= 201402L
+namespace ex1 {
+template  struct partition_indices {
+  static auto compute_right() {}
+  static constexpr auto right = compute_right;
+};
+template struct partition_indices;
+} // namespace ex1
+
+namespace ex2 {
+template  struct X {};
+template  struct partition_indices {
+  static auto compute_right() { return X(); }
+  static constexpr auto right = compute_right;
+  static constexpr int I = sizeof(T);
+  // expected-error@-3 {{no member 'I' in 'dr2335::ex2::partition_indices'; it has not yet been instantiated}}
+  // expected-note@-3 {{in instantiation of member function 'dr2335::ex2::partition_indices::compute_right' requested here}}
+  // expected-note@+3 {{in instantiation of template class 'dr2335::ex2::partition_indices' requested here}}
+  // expected-note@-4 {{not-yet-instantiated member is declared here}}
+};
+template struct partition_indices;
+} // namespace ex2
+
+namespace ex3 {
+struct partition_indices {
+  static auto compute_right() {}
+  static constexpr auto right = compute_right;
+  // expected-error@-1 {{function 'compute_right' with deduced return type cannot be used before it is defined}}
+  // expected-note@-3 {{'compute_right' declared here}}
+  // expected-error@-3 {{declaration of variable 'right' with deduced type 'const auto' requires an initializer}}
+};
+} // namespace ex3
+#endif
+} // namespace dr2335
+
 #if __cplusplus >= 201103L
 namespace dr2338 { // dr2338: 12
 namespace B {
Index: clang/test/CXX/drs/dr18xx.cpp
===
--- clang/test/CXX/drs/dr18xx.cpp
+++ clang/test/CXX/drs/dr18xx.cpp
@@ -136,6 +136,34 @@
   static_assert(!__is_standard_layout(D), "");
 }
 
+namespace dr1890 { // dr1890: no drafting
+// FIXME: current consensus for CWG2335 is that the examples are well-formed.
+namespace ex1 {
+#if __cplusplus >= 201402L
+struct A {
+  struct B {
+auto foo() { return 0; }
+  };
+  decltype(B().foo()) x;
+  // expected-error@-1 {{function 'foo' with deduced return type cannot be used before it is defined}}
+  // expected-note@-4 {{'foo' declared here}}
+};
+#endif
+} // namespace ex1
+
+namespace ex2 {
+#if __cplusplus >= 201103L
+struct Bar {
+  struct Baz {
+int a = 0;
+  };
+  static_assert(__is_constructible(Baz), "");
+  // expected-error@-1 {{static assertion failed}}
+};
+#endif
+} // namespace ex2
+} // namespace dr1890
+
 void dr1891() { // dr1891: 4
 #if __cplusplus >= 201103L
   int n;
Index: clang/test/CXX/drs/dr16xx.cpp
===
--- clang/test/CXX/drs/dr16xx.cpp
+++ clang/test/CXX/drs/dr16xx.cpp
@@ -42,6 +42,28 @@
   C c;
 }
 
+namespace dr1626 { // dr1626: no open
+// FIXME: current consensus for CWG2335 is that the examples are well-form

[PATCH] D148433: [clang] Add tests for DRs about complete-class context

2023-04-17 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill added inline comments.



Comment at: clang/test/CXX/drs/dr23xx.cpp:42
 
+namespace dr2335 { // dr2335: no drafting
+// FIXME: all of the examples are well-formed.

aaron.ballman wrote:
> Endill wrote:
> > shafik wrote:
> > > My comment on 1890 applies here as well.
> > > 
> > > CC @rsmith @aaron.ballman how should we handle DRs that are still in 
> > > process? While we may think we know the direction it is going in, it 
> > > could change.
> > > 
> > > So maybe we should avoid expressing an opinion on whether these are 
> > > well-formed or not?
> > I asked Aaron even before uploading the patch. His response was:
> > > I think it's a judgement call -- if the CWG consensus seems like it makes 
> > > a lot of sense, then I see no reason not to test them but maybe leave a 
> > > FIXME comment about the issue technically being open still. If the CWG 
> > > consensus doesn't make sense, that might be time to get on the reflectors 
> > > and ask questions
> > 
> > Consensus documented in 2335 and drafting notes in P1787 that I quote in 
> > the summary made sense to me, so I published this patch. I can abandon it 
> > if there are fundamental issues with the them, rendering my judgement wrong.
> I'd be curious to hear more thoughts on this.
> 
> In this particular case, this has been in drafting status since 2017, but the 
> final comments on the open issue are:
> ```
> Notes from the June, 2018 meeting:
> 
> The consensus of CWG was to treat templates and classes the same by 
> "instantiating" delayed-parse regions when they are needed instead of at the 
> end of the class.
> 
> See also issue 1890.
> ```
> which seemed sufficiently firm in direction to warrant testing the behavior. 
> I think any open DR being tested is subject to change in Clang and should 
> continue to be documented in cxx_dr_status.html as "not resolved", though (so 
> if CWG does make a change, we can still react to it without having promised 
> the current behavior to users).
As a recap, in D138901 I updated `make_cxx_dr_status` script, so that it can 
take into account unresolved issues. Precedents were 2565 and 2628, which 
resorted to editing `cxx_dr_status.html` manually. Script now make sure that 
`open` or `drafting` bit in the comment matches status from the official page, 
throwing an exception otherwise.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D148433/new/

https://reviews.llvm.org/D148433

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D148433: [clang] Add tests for DRs about complete-class context

2023-04-17 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill added inline comments.



Comment at: clang/test/CXX/drs/dr23xx.cpp:42
 
+namespace dr2335 { // dr2335: no drafting
+// FIXME: all of the examples are well-formed.

shafik wrote:
> My comment on 1890 applies here as well.
> 
> CC @rsmith @aaron.ballman how should we handle DRs that are still in process? 
> While we may think we know the direction it is going in, it could change.
> 
> So maybe we should avoid expressing an opinion on whether these are 
> well-formed or not?
I asked Aaron even before uploading the patch. His response was:
> I think it's a judgement call -- if the CWG consensus seems like it makes a 
> lot of sense, then I see no reason not to test them but maybe leave a FIXME 
> comment about the issue technically being open still. If the CWG consensus 
> doesn't make sense, that might be time to get on the reflectors and ask 
> questions

Consensus documented in 2335 and drafting notes in P1787 that I quote in the 
summary made sense to me, so I published this patch. I can abandon it if there 
are fundamental issues with the them, rendering my judgement wrong.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D148433/new/

https://reviews.llvm.org/D148433

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D148433: [clang] Add tests for DRs about complete-class context

2023-04-15 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill created this revision.
Endill added reviewers: erichkeane, shafik.
Herald added a project: All.
Endill requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

P1787 : The intent for CWG2335 (contra those of the 
older CWG1890, CWG1626, CWG1255, and CWG287) is supported by retaining the 
unrestricted forward lookup in complete-class contexts (despite current 
implementation behavior for non-templates).
Wording: The declaration set is the result of a single search in the scope of C 
for N from immediately after the class-specifier of C if P is in a 
complete-class context of C or from P otherwise. [Drafting note: The plan for 
CWG2335 is to describe forbidden dependency cycles among the complete-class 
contexts of a class. — end drafting note] ([class.member.lookup]/4)

Complete-class context is described in [class.mem.general] p7 
 and p8 
. In this patch I add tests only 
for CWG issues that fall under current definition of complete-class context, 
because I'm not sure how CWG1255 and CWG287 are going to work. That's why I 
skip over them, but mark CWG1308 as superseded by CWG1330.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D148433

Files:
  clang/test/CXX/drs/dr13xx.cpp
  clang/test/CXX/drs/dr16xx.cpp
  clang/test/CXX/drs/dr18xx.cpp
  clang/test/CXX/drs/dr23xx.cpp
  clang/www/cxx_dr_status.html

Index: clang/www/cxx_dr_status.html
===
--- clang/www/cxx_dr_status.html
+++ clang/www/cxx_dr_status.html
@@ -2661,7 +2661,7 @@
 https://cplusplus.github.io/CWG/issues/437.html";>437
 CD1
 Is type of class allowed in member function exception specification?
-Superseded by 1308
+Superseded by 1308
   
   
 https://cplusplus.github.io/CWG/issues/438.html";>438
@@ -7655,7 +7655,7 @@
 https://cplusplus.github.io/CWG/issues/1308.html";>1308
 CD3
 Completeness of class type within an exception-specification
-Unknown
+Superseded by 1330
   
   
 https://cplusplus.github.io/CWG/issues/1309.html";>1309
@@ -9563,7 +9563,7 @@
 https://cplusplus.github.io/CWG/issues/1626.html";>1626
 open
 constexpr member functions in brace-or-equal-initializers
-Not resolved
+No
   
   
 https://cplusplus.github.io/CWG/issues/1627.html";>1627
@@ -11147,7 +11147,7 @@
 https://cplusplus.github.io/CWG/issues/1890.html";>1890
 drafting
 Member type depending on definition of member function
-Not resolved
+No
   
   
 https://cplusplus.github.io/CWG/issues/1891.html";>1891
@@ -13817,7 +13817,7 @@
 https://cplusplus.github.io/CWG/issues/2335.html";>2335
 drafting
 Deduced return types vs member types
-Not resolved
+No
   
   
 https://cplusplus.github.io/CWG/issues/2336.html";>2336
Index: clang/test/CXX/drs/dr23xx.cpp
===
--- clang/test/CXX/drs/dr23xx.cpp
+++ clang/test/CXX/drs/dr23xx.cpp
@@ -39,6 +39,43 @@
 
 // dr2331: na
 
+namespace dr2335 { // dr2335: no drafting
+// FIXME: all of the examples are well-formed.
+#if __cplusplus >= 201402L
+namespace ex1 {
+template  struct partition_indices {
+  static auto compute_right() {}
+  static constexpr auto right = compute_right;
+};
+template struct partition_indices;
+} // namespace ex1
+
+namespace ex2 {
+template  struct X {};
+template  struct partition_indices {
+  static auto compute_right() { return X(); }
+  static constexpr auto right = compute_right;
+  static constexpr int I = sizeof(T);
+  // expected-error@-3 {{no member 'I' in 'dr2335::ex2::partition_indices'; it has not yet been instantiated}}
+  // expected-note@-3 {{in instantiation of member function 'dr2335::ex2::partition_indices::compute_right' requested here}}
+  // expected-note@+3 {{in instantiation of template class 'dr2335::ex2::partition_indices' requested here}}
+  // expected-note@-4 {{not-yet-instantiated member is declared here}}
+};
+template struct partition_indices;
+} // namespace ex2
+
+namespace ex3 {
+struct partition_indices {
+  static auto compute_right() {}
+  static constexpr auto right = compute_right;
+  // expected-error@-1 {{function 'compute_right' with deduced return type cannot be used before it is defined}}
+  // expected-note@-3 {{'compute_right' declared here}}
+  // expected-error@-3 {{declaration of variable 'right' with deduced type 'const auto' requires an initializer}}
+};
+} // namespace ex3
+#endif
+} // namespace dr2335
+
 #if __cplusplus >= 201103L
 namespace dr2338 { // dr2338: 12
 namespace B {
Index: clang/test/CXX/drs/dr18xx.cpp
===
--- clang/test/CXX/drs/dr18xx.cpp
+++ clang/test/CXX/drs/dr18xx.cpp
@@ -136,6 +136,34 @@
   static_assert(!__is_standard_layout(D), "");
 }
 
+namespace dr18

[PATCH] D148260: [clang] Mark CWG2331 as N/A

2023-04-15 Thread Vlad Serebrennikov via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG19ef8e8446df: [clang] Mark CWG2331 as N/A (authored by 
Endill).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D148260/new/

https://reviews.llvm.org/D148260

Files:
  clang/test/CXX/drs/dr23xx.cpp
  clang/www/cxx_dr_status.html


Index: clang/www/cxx_dr_status.html
===
--- clang/www/cxx_dr_status.html
+++ clang/www/cxx_dr_status.html
@@ -13793,7 +13793,7 @@
 https://cplusplus.github.io/CWG/issues/2331.html";>2331
 CD6
 Redundancy in description of class scope
-Unknown
+N/A
   
   
 https://cplusplus.github.io/CWG/issues/2332.html";>2332
Index: clang/test/CXX/drs/dr23xx.cpp
===
--- clang/test/CXX/drs/dr23xx.cpp
+++ clang/test/CXX/drs/dr23xx.cpp
@@ -171,6 +171,8 @@
 } //namespace dr2303
 #endif
 
+// dr2331: na
+
 namespace dr2370 { // dr2370: no
 namespace N {
 typedef int type;


Index: clang/www/cxx_dr_status.html
===
--- clang/www/cxx_dr_status.html
+++ clang/www/cxx_dr_status.html
@@ -13793,7 +13793,7 @@
 https://cplusplus.github.io/CWG/issues/2331.html";>2331
 CD6
 Redundancy in description of class scope
-Unknown
+N/A
   
   
 https://cplusplus.github.io/CWG/issues/2332.html";>2332
Index: clang/test/CXX/drs/dr23xx.cpp
===
--- clang/test/CXX/drs/dr23xx.cpp
+++ clang/test/CXX/drs/dr23xx.cpp
@@ -171,6 +171,8 @@
 } //namespace dr2303
 #endif
 
+// dr2331: na
+
 namespace dr2370 { // dr2370: no
 namespace N {
 typedef int type;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D148136: [clang] Add test for CWG1894 and CWG2199

2023-04-14 Thread Vlad Serebrennikov via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG576c752410e7: [clang] Add test for CWG1894 and CWG2199 
(authored by Endill).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D148136/new/

https://reviews.llvm.org/D148136

Files:
  clang/test/CXX/drs/dr18xx.cpp
  clang/test/CXX/drs/dr21xx.cpp
  clang/test/CXX/drs/dr4xx.cpp
  clang/www/cxx_dr_status.html

Index: clang/www/cxx_dr_status.html
===
--- clang/www/cxx_dr_status.html
+++ clang/www/cxx_dr_status.html
@@ -11171,7 +11171,7 @@
 https://cplusplus.github.io/CWG/issues/1894.html";>1894
 CD6
 typedef-names and using-declarations
-Unknown
+Clang 3.8
   
   
 https://cplusplus.github.io/CWG/issues/1895.html";>1895
@@ -13001,7 +13001,7 @@
 https://cplusplus.github.io/CWG/issues/2199.html";>2199
 CD6
 Typedefs and tags
-Unknown
+Clang 3.8
   
   
 https://cplusplus.github.io/CWG/issues/2200.html";>2200
Index: clang/test/CXX/drs/dr4xx.cpp
===
--- clang/test/CXX/drs/dr4xx.cpp
+++ clang/test/CXX/drs/dr4xx.cpp
@@ -124,6 +124,7 @@
 }
 
 namespace dr407 { // dr407: 3.8
+  // NB: reused by dr1894 and dr2199
   struct S;
   typedef struct S S;
   void f() {
Index: clang/test/CXX/drs/dr21xx.cpp
===
--- clang/test/CXX/drs/dr21xx.cpp
+++ clang/test/CXX/drs/dr21xx.cpp
@@ -1,7 +1,9 @@
 // RUN: %clang_cc1 -std=c++98 -triple x86_64-unknown-unknown %s -verify -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
 // RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-unknown %s -verify -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
 // RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown %s -verify -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
-// RUN: %clang_cc1 -std=c++1z -triple x86_64-unknown-unknown %s -verify -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-unknown %s -verify -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-unknown %s -verify -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++2b -triple x86_64-unknown-unknown %s -verify -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
 
 #if __cplusplus < 201103L
 // expected-error@+1 {{variadic macro}}
@@ -188,3 +190,31 @@
   B &B::operator=(B&&) = default; // expected-error {{would delete}} expected-note@-10{{inaccessible move assignment}}
 #endif
 }
+
+namespace dr2199 { // dr2199: 3.8
+   // NB: reusing part of dr407 test
+namespace A {
+  struct S {};
+}
+namespace B {
+  typedef int S;
+}
+namespace E {
+  typedef A::S S;
+  using A::S;
+  struct S s;
+}
+namespace F {
+  typedef A::S S;
+}
+namespace G {
+  using namespace A;
+  using namespace F;
+  struct S s;
+}
+namespace H {
+  using namespace F;
+  using namespace A;
+  struct S s;
+}
+}
Index: clang/test/CXX/drs/dr18xx.cpp
===
--- clang/test/CXX/drs/dr18xx.cpp
+++ clang/test/CXX/drs/dr18xx.cpp
@@ -168,3 +168,31 @@
   b = static_cast(b); // expected-error {{copy assignment operator is implicitly deleted}}
 #endif
 }
+
+namespace dr1894 { // dr1894: 3.8
+   // NB: reusing part of dr407 test
+namespace A {
+  struct S {};
+}
+namespace B {
+  typedef int S;
+}
+namespace E {
+  typedef A::S S;
+  using A::S;
+  struct S s;
+}
+namespace F {
+  typedef A::S S;
+}
+namespace G {
+  using namespace A;
+  using namespace F;
+  struct S s;
+}
+namespace H {
+  using namespace F;
+  using namespace A;
+  struct S s;
+}
+}
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D148136: [clang] Add test for CWG1894 and CWG2199

2023-04-14 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill updated this revision to Diff 513457.
Endill added a comment.

rebase


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D148136/new/

https://reviews.llvm.org/D148136

Files:
  clang/test/CXX/drs/dr18xx.cpp
  clang/test/CXX/drs/dr21xx.cpp
  clang/test/CXX/drs/dr4xx.cpp
  clang/www/cxx_dr_status.html

Index: clang/www/cxx_dr_status.html
===
--- clang/www/cxx_dr_status.html
+++ clang/www/cxx_dr_status.html
@@ -11171,7 +11171,7 @@
 https://cplusplus.github.io/CWG/issues/1894.html";>1894
 CD6
 typedef-names and using-declarations
-Unknown
+Clang 3.8
   
   
 https://cplusplus.github.io/CWG/issues/1895.html";>1895
@@ -13001,7 +13001,7 @@
 https://cplusplus.github.io/CWG/issues/2199.html";>2199
 CD6
 Typedefs and tags
-Unknown
+Clang 3.8
   
   
 https://cplusplus.github.io/CWG/issues/2200.html";>2200
Index: clang/test/CXX/drs/dr4xx.cpp
===
--- clang/test/CXX/drs/dr4xx.cpp
+++ clang/test/CXX/drs/dr4xx.cpp
@@ -124,6 +124,7 @@
 }
 
 namespace dr407 { // dr407: 3.8
+  // NB: reused by dr1894 and dr2199
   struct S;
   typedef struct S S;
   void f() {
Index: clang/test/CXX/drs/dr21xx.cpp
===
--- clang/test/CXX/drs/dr21xx.cpp
+++ clang/test/CXX/drs/dr21xx.cpp
@@ -1,7 +1,9 @@
 // RUN: %clang_cc1 -std=c++98 -triple x86_64-unknown-unknown %s -verify -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
 // RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-unknown %s -verify -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
 // RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown %s -verify -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
-// RUN: %clang_cc1 -std=c++1z -triple x86_64-unknown-unknown %s -verify -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-unknown %s -verify -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-unknown %s -verify -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++2b -triple x86_64-unknown-unknown %s -verify -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
 
 #if __cplusplus < 201103L
 // expected-error@+1 {{variadic macro}}
@@ -188,3 +190,31 @@
   B &B::operator=(B&&) = default; // expected-error {{would delete}} expected-note@-10{{inaccessible move assignment}}
 #endif
 }
+
+namespace dr2199 { // dr2199: 3.8
+   // NB: reusing part of dr407 test
+namespace A {
+  struct S {};
+}
+namespace B {
+  typedef int S;
+}
+namespace E {
+  typedef A::S S;
+  using A::S;
+  struct S s;
+}
+namespace F {
+  typedef A::S S;
+}
+namespace G {
+  using namespace A;
+  using namespace F;
+  struct S s;
+}
+namespace H {
+  using namespace F;
+  using namespace A;
+  struct S s;
+}
+}
Index: clang/test/CXX/drs/dr18xx.cpp
===
--- clang/test/CXX/drs/dr18xx.cpp
+++ clang/test/CXX/drs/dr18xx.cpp
@@ -168,3 +168,31 @@
   b = static_cast(b); // expected-error {{copy assignment operator is implicitly deleted}}
 #endif
 }
+
+namespace dr1894 { // dr1894: 3.8
+   // NB: reusing part of dr407 test
+namespace A {
+  struct S {};
+}
+namespace B {
+  typedef int S;
+}
+namespace E {
+  typedef A::S S;
+  using A::S;
+  struct S s;
+}
+namespace F {
+  typedef A::S S;
+}
+namespace G {
+  using namespace A;
+  using namespace F;
+  struct S s;
+}
+namespace H {
+  using namespace F;
+  using namespace A;
+  struct S s;
+}
+}
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D148260: [clang] Mark CWG2331 as N/A

2023-04-14 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill added a comment.

In D148260#4266802 , @shafik wrote:

> The defect report has two examples even though the first one is commented 
> incorrectly considering the final resolution. I am sure they are covered in 
> the test suite in other places but why not add them?

My understanding of this CWG is the following. There was redundant wording. 
Then someone came up with wording that fixes that. Then it was identified that 
proposed wording is defective, and gives couple of examples, which was enough 
to return issue to "drafting".
What I find important here is that no behavioral changes were introduced. Those 
examples just give a hint what a //conformance// test for those paragraphs 
should take into account.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D148260/new/

https://reviews.llvm.org/D148260

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D148263: [clang] Mark CWG2009 as N/A

2023-04-13 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill created this revision.
Endill added reviewers: clang-language-wg, shafik.
Herald added a project: All.
Endill requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

P1787 : CWG2331 is resolved by defining lookup from 
complete-class contexts and out-of-line member definitions. The rest of CWG2009 
is resolved by making it ill-formed NDR for forward lookup outside a 
complete-class context to change the results (before overload resolution, to 
avoid differences in instantiation).
Wording: The result of the search is the declaration set of S(N, T). If it is 
an invalid set, the program is ill-formed. If it differs from the result of a 
search in T for N from immediately after the class-specifier of T, the program 
is ill-formed, no diagnostic required. ([class.member.lookup]/7)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D148263

Files:
  clang/test/CXX/drs/dr20xx.cpp
  clang/www/cxx_dr_status.html


Index: clang/www/cxx_dr_status.html
===
--- clang/www/cxx_dr_status.html
+++ clang/www/cxx_dr_status.html
@@ -11861,7 +11861,7 @@
 https://cplusplus.github.io/CWG/issues/2009.html";>2009
 CD6
 Unclear specification of class scope
-Unknown
+N/A
   
   
 https://cplusplus.github.io/CWG/issues/2010.html";>2010
Index: clang/test/CXX/drs/dr20xx.cpp
===
--- clang/test/CXX/drs/dr20xx.cpp
+++ clang/test/CXX/drs/dr20xx.cpp
@@ -19,6 +19,8 @@
 int b = __builtin_addressof(b2)->foo; // expected-error {{no member}}
 }
 
+// dr2009: na
+
 namespace dr2026 { // dr2026: 11
   template struct X {};
 


Index: clang/www/cxx_dr_status.html
===
--- clang/www/cxx_dr_status.html
+++ clang/www/cxx_dr_status.html
@@ -11861,7 +11861,7 @@
 https://cplusplus.github.io/CWG/issues/2009.html";>2009
 CD6
 Unclear specification of class scope
-Unknown
+N/A
   
   
 https://cplusplus.github.io/CWG/issues/2010.html";>2010
Index: clang/test/CXX/drs/dr20xx.cpp
===
--- clang/test/CXX/drs/dr20xx.cpp
+++ clang/test/CXX/drs/dr20xx.cpp
@@ -19,6 +19,8 @@
 int b = __builtin_addressof(b2)->foo; // expected-error {{no member}}
 }
 
+// dr2009: na
+
 namespace dr2026 { // dr2026: 11
   template struct X {};
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D148260: [clang] Mark CWG2331 as N/A

2023-04-13 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill created this revision.
Endill added reviewers: clang-language-wg, shafik.
Herald added a project: All.
Endill requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

P1787 : CWG2331 is resolved by defining lookup from 
complete-class contexts and out-of-line member definitions.
Wording: The declaration set is the result of a single search in the scope of C 
for N from immediately after the class-specifier of C if P is in a 
complete-class context of C or from P otherwise. ([class.member.lookup]/4)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D148260

Files:
  clang/test/CXX/drs/dr23xx.cpp
  clang/www/cxx_dr_status.html


Index: clang/www/cxx_dr_status.html
===
--- clang/www/cxx_dr_status.html
+++ clang/www/cxx_dr_status.html
@@ -13793,7 +13793,7 @@
 https://cplusplus.github.io/CWG/issues/2331.html";>2331
 CD6
 Redundancy in description of class scope
-Unknown
+N/A
   
   
 https://cplusplus.github.io/CWG/issues/2332.html";>2332
Index: clang/test/CXX/drs/dr23xx.cpp
===
--- clang/test/CXX/drs/dr23xx.cpp
+++ clang/test/CXX/drs/dr23xx.cpp
@@ -171,6 +171,8 @@
 } //namespace dr2303
 #endif
 
+// dr2331: na
+
 namespace dr2370 { // dr2370: no
 namespace N {
 typedef int type;


Index: clang/www/cxx_dr_status.html
===
--- clang/www/cxx_dr_status.html
+++ clang/www/cxx_dr_status.html
@@ -13793,7 +13793,7 @@
 https://cplusplus.github.io/CWG/issues/2331.html";>2331
 CD6
 Redundancy in description of class scope
-Unknown
+N/A
   
   
 https://cplusplus.github.io/CWG/issues/2332.html";>2332
Index: clang/test/CXX/drs/dr23xx.cpp
===
--- clang/test/CXX/drs/dr23xx.cpp
+++ clang/test/CXX/drs/dr23xx.cpp
@@ -171,6 +171,8 @@
 } //namespace dr2303
 #endif
 
+// dr2331: na
+
 namespace dr2370 { // dr2370: no
 namespace N {
 typedef int type;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D148136: [clang] Add test for CWG1894 and CWG2199

2023-04-12 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill updated this revision to Diff 512910.
Endill edited the summary of this revision.
Endill added a comment.

Remove parts of CWG1894 and CWG2199 tests that are resolved by CWG407


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D148136/new/

https://reviews.llvm.org/D148136

Files:
  clang/test/CXX/drs/dr18xx.cpp
  clang/test/CXX/drs/dr21xx.cpp
  clang/test/CXX/drs/dr4xx.cpp
  clang/www/cxx_dr_status.html

Index: clang/www/cxx_dr_status.html
===
--- clang/www/cxx_dr_status.html
+++ clang/www/cxx_dr_status.html
@@ -11171,7 +11171,7 @@
 https://wg21.link/cwg1894";>1894
 CD6
 typedef-names and using-declarations
-Unknown
+Clang 3.8
   
   
 https://wg21.link/cwg1895";>1895
@@ -13001,7 +13001,7 @@
 https://wg21.link/cwg2199";>2199
 CD6
 Typedefs and tags
-Unknown
+Clang 3.8
   
   
 https://wg21.link/cwg2200";>2200
Index: clang/test/CXX/drs/dr4xx.cpp
===
--- clang/test/CXX/drs/dr4xx.cpp
+++ clang/test/CXX/drs/dr4xx.cpp
@@ -124,6 +124,7 @@
 }
 
 namespace dr407 { // dr407: 3.8
+  // NB: reused by dr1894 and dr2199
   struct S;
   typedef struct S S;
   void f() {
Index: clang/test/CXX/drs/dr21xx.cpp
===
--- clang/test/CXX/drs/dr21xx.cpp
+++ clang/test/CXX/drs/dr21xx.cpp
@@ -1,7 +1,9 @@
 // RUN: %clang_cc1 -std=c++98 -triple x86_64-unknown-unknown %s -verify -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
 // RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-unknown %s -verify -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
 // RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown %s -verify -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
-// RUN: %clang_cc1 -std=c++1z -triple x86_64-unknown-unknown %s -verify -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-unknown %s -verify -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-unknown %s -verify -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++2b -triple x86_64-unknown-unknown %s -verify -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
 
 #if __cplusplus < 201103L
 // expected-error@+1 {{variadic macro}}
@@ -188,3 +190,31 @@
   B &B::operator=(B&&) = default; // expected-error {{would delete}} expected-note@-10{{inaccessible move assignment}}
 #endif
 }
+
+namespace dr2199 { // dr2199: 3.8
+   // NB: reusing part of dr407 test
+namespace A {
+  struct S {};
+}
+namespace B {
+  typedef int S;
+}
+namespace E {
+  typedef A::S S;
+  using A::S;
+  struct S s;
+}
+namespace F {
+  typedef A::S S;
+}
+namespace G {
+  using namespace A;
+  using namespace F;
+  struct S s;
+}
+namespace H {
+  using namespace F;
+  using namespace A;
+  struct S s;
+}
+}
Index: clang/test/CXX/drs/dr18xx.cpp
===
--- clang/test/CXX/drs/dr18xx.cpp
+++ clang/test/CXX/drs/dr18xx.cpp
@@ -168,3 +168,31 @@
   b = static_cast(b); // expected-error {{copy assignment operator is implicitly deleted}}
 #endif
 }
+
+namespace dr1894 { // dr1894: 3.8
+   // NB: reusing part of dr407 test
+namespace A {
+  struct S {};
+}
+namespace B {
+  typedef int S;
+}
+namespace E {
+  typedef A::S S;
+  using A::S;
+  struct S s;
+}
+namespace F {
+  typedef A::S S;
+}
+namespace G {
+  using namespace A;
+  using namespace F;
+  struct S s;
+}
+namespace H {
+  using namespace F;
+  using namespace A;
+  struct S s;
+}
+}
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D148136: [clang] Add test for CWG1894 and CWG2199

2023-04-12 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill added inline comments.



Comment at: clang/www/cxx_dr_status.html:13004
 Typedefs and tags
-Unknown
+Clang 3.8
   

erichkeane wrote:
> Endill wrote:
> > cor3ntin wrote:
> > > I would just say "Yes", i think clang 3.8 predates these issues
> > It's not the case: 2199 was filed 12.11.2015, but 3.8 was released on 
> > 08.03.2016.
> I don't think that is a policy we have anyway.  We frequently just say "this 
> has worked since Clang X.X" even with much more recent DRs than the release.
Yes, up until now I'd just throw tests into compiler explorer, and look when 
clang started behaving the way it does today. I say "Yes" upon hitting 3.0, 
which is the oldest available.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D148136/new/

https://reviews.llvm.org/D148136

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D148136: [clang] Add test for CWG1894 and CWG2199

2023-04-12 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill added inline comments.



Comment at: clang/www/cxx_dr_status.html:13004
 Typedefs and tags
-Unknown
+Clang 3.8
   

cor3ntin wrote:
> I would just say "Yes", i think clang 3.8 predates these issues
It's not the case: 2199 was filed 12.11.2015, but 3.8 was released on 
08.03.2016.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D148136/new/

https://reviews.llvm.org/D148136

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D148146: [clang] Make make_cxx_dr_status script runnable from anywhere

2023-04-12 Thread Vlad Serebrennikov via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGd945b6496ec6: [clang] Make make_cxx_dr_status script 
runnable from anywhere (authored by Endill).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D148146/new/

https://reviews.llvm.org/D148146

Files:
  clang/www/make_cxx_dr_status


Index: clang/www/make_cxx_dr_status
===
--- clang/www/make_cxx_dr_status
+++ clang/www/make_cxx_dr_status
@@ -2,10 +2,11 @@
 import sys, os, re, urllib.request
 
 
-default_issue_list_path = 'cwg_index.html'
+clang_www_dir = os.path.dirname(__file__)
+default_issue_list_path = os.path.join(clang_www_dir, 'cwg_index.html')
 issue_list_url = "https://www.open-std.org/jtc1/sc22/wg21/docs/cwg_index.html";
-output = 'cxx_dr_status.html'
-dr_test_dir = '../test/CXX/drs'
+output = os.path.join(clang_www_dir, 'cxx_dr_status.html')
+dr_test_dir = os.path.join(clang_www_dir, '../test/CXX/drs')
 
 class DR:
   def __init__(self, section, issue, url, status, title):


Index: clang/www/make_cxx_dr_status
===
--- clang/www/make_cxx_dr_status
+++ clang/www/make_cxx_dr_status
@@ -2,10 +2,11 @@
 import sys, os, re, urllib.request
 
 
-default_issue_list_path = 'cwg_index.html'
+clang_www_dir = os.path.dirname(__file__)
+default_issue_list_path = os.path.join(clang_www_dir, 'cwg_index.html')
 issue_list_url = "https://www.open-std.org/jtc1/sc22/wg21/docs/cwg_index.html";
-output = 'cxx_dr_status.html'
-dr_test_dir = '../test/CXX/drs'
+output = os.path.join(clang_www_dir, 'cxx_dr_status.html')
+dr_test_dir = os.path.join(clang_www_dir, '../test/CXX/drs')
 
 class DR:
   def __init__(self, section, issue, url, status, title):
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D148136: [clang] Add test for CWG1894 and CWG2199

2023-04-12 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill added a comment.

Thank you for taking a look at this.




Comment at: clang/test/CXX/drs/dr18xx.cpp:172-227
+namespace dr1894 { // dr1894: 3.8
+   // NB: reusing dr407 test
+  struct S;
+  typedef struct S S;
+  void f() {
+struct S *p;
+{

cor3ntin wrote:
> I think i would prefer reusing verbatim the example in 1894 - lines 207 and 
> following basically - as the issue clearly state that what comes before is 
> resolved by 407 so not really relevant here
Does the same apply to 2199? It also contains examples resolved by 407.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D148136/new/

https://reviews.llvm.org/D148136

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D148146: [clang] Make make_cxx_dr_status script runnable from anywhere

2023-04-12 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill created this revision.
Endill added reviewers: clang-language-wg, cor3ntin.
Herald added a project: All.
Endill requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This script has hardcoded relative paths to `clang/test/CXX/drs`, 
`cwg_index.html`, and `cxx_dr_status.html`, which requires running it with 
`clang/www` CWD. This patch makes those paths relative to path of the script 
itself, so that it could be run from anywhere.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D148146

Files:
  clang/www/make_cxx_dr_status


Index: clang/www/make_cxx_dr_status
===
--- clang/www/make_cxx_dr_status
+++ clang/www/make_cxx_dr_status
@@ -2,10 +2,11 @@
 import sys, os, re, urllib.request
 
 
-default_issue_list_path = 'cwg_index.html'
+clang_www_dir = os.path.dirname(__file__)
+default_issue_list_path = os.path.join(clang_www_dir, 'cwg_index.html')
 issue_list_url = "https://www.open-std.org/jtc1/sc22/wg21/docs/cwg_index.html";
-output = 'cxx_dr_status.html'
-dr_test_dir = '../test/CXX/drs'
+output = os.path.join(clang_www_dir, 'cxx_dr_status.html')
+dr_test_dir = os.path.join(clang_www_dir, '../test/CXX/drs')
 
 class DR:
   def __init__(self, section, issue, url, status, title):


Index: clang/www/make_cxx_dr_status
===
--- clang/www/make_cxx_dr_status
+++ clang/www/make_cxx_dr_status
@@ -2,10 +2,11 @@
 import sys, os, re, urllib.request
 
 
-default_issue_list_path = 'cwg_index.html'
+clang_www_dir = os.path.dirname(__file__)
+default_issue_list_path = os.path.join(clang_www_dir, 'cwg_index.html')
 issue_list_url = "https://www.open-std.org/jtc1/sc22/wg21/docs/cwg_index.html";
-output = 'cxx_dr_status.html'
-dr_test_dir = '../test/CXX/drs'
+output = os.path.join(clang_www_dir, 'cxx_dr_status.html')
+dr_test_dir = os.path.join(clang_www_dir, '../test/CXX/drs')
 
 class DR:
   def __init__(self, section, issue, url, status, title):
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D148136: [clang] Add test for CWG1894 and CWG2199

2023-04-12 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill created this revision.
Endill added a reviewer: clang-language-wg.
Herald added a project: All.
Endill requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

P1787 : CWG1894 and its duplicate CWG2199 are resolved 
per Richard’s proposal for “dr407 still leaves open questions about typedef / 
tag hiding” 
, using 
generic conflicting-declaration rules even for typedef, and discarding a 
redundant typedef-name when looking up an elaborated-type-specifier.
Wording: See changes to [dcl.typedef], [basic.lookup.elab], and 
[basic.lookup]/4.

Generic conflicting-declaration rules are specified in changes to 
[basic.scope.scope]. CWG407 , 
CWG1894 , and CWG2199 
 discuss how elaborated type 
specifiers interact with typedef, using directives, and using declarations. 
Since existing test for CWG407 covers examples provided in CWG1894 and CWG2199, 
and does it in accordance with P1787 , I reused 
it.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D148136

Files:
  clang/test/CXX/drs/dr18xx.cpp
  clang/test/CXX/drs/dr21xx.cpp
  clang/test/CXX/drs/dr4xx.cpp
  clang/www/cxx_dr_status.html

Index: clang/www/cxx_dr_status.html
===
--- clang/www/cxx_dr_status.html
+++ clang/www/cxx_dr_status.html
@@ -11171,7 +11171,7 @@
 https://wg21.link/cwg1894";>1894
 CD6
 typedef-names and using-declarations
-Unknown
+Clang 3.8
   
   
 https://wg21.link/cwg1895";>1895
@@ -13001,7 +13001,7 @@
 https://wg21.link/cwg2199";>2199
 CD6
 Typedefs and tags
-Unknown
+Clang 3.8
   
   
 https://wg21.link/cwg2200";>2200
Index: clang/test/CXX/drs/dr4xx.cpp
===
--- clang/test/CXX/drs/dr4xx.cpp
+++ clang/test/CXX/drs/dr4xx.cpp
@@ -124,6 +124,7 @@
 }
 
 namespace dr407 { // dr407: 3.8
+  // NB: reused by dr1894 and dr2199
   struct S;
   typedef struct S S;
   void f() {
Index: clang/test/CXX/drs/dr21xx.cpp
===
--- clang/test/CXX/drs/dr21xx.cpp
+++ clang/test/CXX/drs/dr21xx.cpp
@@ -1,7 +1,9 @@
 // RUN: %clang_cc1 -std=c++98 -triple x86_64-unknown-unknown %s -verify -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
 // RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-unknown %s -verify -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
 // RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown %s -verify -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
-// RUN: %clang_cc1 -std=c++1z -triple x86_64-unknown-unknown %s -verify -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-unknown %s -verify -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-unknown %s -verify -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++2b -triple x86_64-unknown-unknown %s -verify -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
 
 #if __cplusplus < 201103L
 // expected-error@+1 {{variadic macro}}
@@ -188,3 +190,60 @@
   B &B::operator=(B&&) = default; // expected-error {{would delete}} expected-note@-10{{inaccessible move assignment}}
 #endif
 }
+
+namespace dr2199 { // dr2199: 3.8
+   // NB: reusing dr407 test
+  struct S;
+  typedef struct S S;
+  void f() {
+struct S *p;
+{
+  typedef struct S S; // #dr2199-typedef-S-S
+  struct S *p;
+  // expected-error@-1 {{typedef 'S' cannot be referenced with a struct specifier}}
+  // expected-note@#dr2199-typedef-S-S {{here}}
+}
+  }
+  struct S {};
+
+  namespace UsingDir {
+namespace A {
+  struct S {}; // #dr2199-struct-S
+}
+namespace B {
+  typedef int S; // #dr2199-typedef-int-S
+}
+namespace C {
+  using namespace A;
+  using namespace B;
+  struct S s;
+  // expected-error@-1 {{ambiguous}}
+  // expected-note@#dr2199-struct-S {{candidate}}
+  // expected-note@#dr2199-typedef-int-S {{candidate}}
+}
+namespace D {
+  using A::S;
+  typedef struct S S;
+  struct S s;
+}
+namespace E {
+  typedef A::S S;
+  using A::S;
+  struct S s;
+}
+namespace F {
+  typedef A::S S;
+}
+
+namespace G {
+  using namespace A;
+  using namespace F;
+  struct S s;
+}
+namespace H {
+  using namespace F;
+  using namespace A;
+  struct S s;
+}
+  }
+}
Index: clang/test/

[PATCH] D148035: [clang] Add test for CWG1837

2023-04-11 Thread Vlad Serebrennikov via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGaa7aedd8ea3f: [clang] Add test for CWG1837 (authored by 
Endill).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D148035/new/

https://reviews.llvm.org/D148035

Files:
  clang/test/CXX/drs/dr18xx.cpp
  clang/www/cxx_dr_status.html


Index: clang/www/cxx_dr_status.html
===
--- clang/www/cxx_dr_status.html
+++ clang/www/cxx_dr_status.html
@@ -10829,7 +10829,7 @@
 https://wg21.link/cwg1837";>1837
 CD6
 Use of this in friend and local class 
declarations
-Unknown
+Clang 3.3
   
   
 https://wg21.link/cwg1838";>1838
Index: clang/test/CXX/drs/dr18xx.cpp
===
--- clang/test/CXX/drs/dr18xx.cpp
+++ clang/test/CXX/drs/dr18xx.cpp
@@ -2,7 +2,8 @@
 // RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-unknown %s -verify 
-fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
 // RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown %s -verify 
-fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
 // RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-unknown %s -verify 
-fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
-// RUN: %clang_cc1 -std=c++2a -triple x86_64-unknown-unknown %s -verify 
-fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-unknown %s -verify 
-fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++2b -triple x86_64-unknown-unknown %s -verify 
-fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
 
 #if __cplusplus < 201103L
 // expected-error@+1 {{variadic macro}}
@@ -59,6 +60,43 @@
 #endif
 }
 
+namespace dr1837 { // dr1837: 3.3
+#if __cplusplus >= 201103L
+  template 
+  struct Fish { static const bool value = true; };
+
+  struct Other {
+int p();
+auto q() -> decltype(p()) *;
+  };
+
+  class Outer {
+friend auto Other::q() -> decltype(this->p()) *; // expected-error 
{{invalid use of 'this'}}
+int g();
+int f() {
+  extern void f(decltype(this->g()) *);
+  struct Inner {
+static_assert(Fishg())>::value, ""); // expected-error 
{{invalid use of 'this'}}
+enum { X = Fishf())>::value }; // expected-error 
{{invalid use of 'this'}}
+struct Inner2 : Fishg())> { }; // expected-error 
{{invalid use of 'this'}}
+friend void f(decltype(this->g()) *); // expected-error {{invalid use 
of 'this'}}
+friend auto Other::q() -> decltype(this->p()) *; // expected-error 
{{invalid use of 'this'}}
+  };
+  return 0;
+}
+  };
+
+  struct A {
+int f();
+bool b = [] {
+  struct Local {
+static_assert(sizeof(this->f()) == sizeof(int), "");
+  };
+};
+  };
+#endif
+}
+
 namespace dr1872 { // dr1872: 9
 #if __cplusplus >= 201103L
   template struct A : T {


Index: clang/www/cxx_dr_status.html
===
--- clang/www/cxx_dr_status.html
+++ clang/www/cxx_dr_status.html
@@ -10829,7 +10829,7 @@
 https://wg21.link/cwg1837";>1837
 CD6
 Use of this in friend and local class declarations
-Unknown
+Clang 3.3
   
   
 https://wg21.link/cwg1838";>1838
Index: clang/test/CXX/drs/dr18xx.cpp
===
--- clang/test/CXX/drs/dr18xx.cpp
+++ clang/test/CXX/drs/dr18xx.cpp
@@ -2,7 +2,8 @@
 // RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-unknown %s -verify -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
 // RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown %s -verify -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
 // RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-unknown %s -verify -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
-// RUN: %clang_cc1 -std=c++2a -triple x86_64-unknown-unknown %s -verify -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-unknown %s -verify -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++2b -triple x86_64-unknown-unknown %s -verify -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
 
 #if __cplusplus < 201103L
 // expected-error@+1 {{variadic macro}}
@@ -59,6 +60,43 @@
 #endif
 }
 
+namespace dr1837 { // dr1837: 3.3
+#if __cplusplus >= 201103L
+  template 
+  struct Fish { static const bool value = true; };
+
+  struct Other {
+int p();
+auto q() -> decltype(p()) *;
+  };
+
+  class Outer {
+friend auto Other::q() -> decltype(this->p()) *; // expected-error {{invalid use of 'this'}}
+int 

[PATCH] D147839: [clang] Add test for CWG2007

2023-04-11 Thread Vlad Serebrennikov via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGa4beecef8f40: [clang] Add test for CWG2007 (authored by 
Endill).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D147839/new/

https://reviews.llvm.org/D147839

Files:
  clang/test/CXX/drs/dr20xx.cpp
  clang/www/cxx_dr_status.html


Index: clang/www/cxx_dr_status.html
===
--- clang/www/cxx_dr_status.html
+++ clang/www/cxx_dr_status.html
@@ -11849,7 +11849,7 @@
 https://wg21.link/cwg2007";>2007
 CD6
 Argument-dependent lookup for operator=
-Unknown
+Clang 3.4
   
   
 https://wg21.link/cwg2008";>2008
Index: clang/test/CXX/drs/dr20xx.cpp
===
--- clang/test/CXX/drs/dr20xx.cpp
+++ clang/test/CXX/drs/dr20xx.cpp
@@ -3,12 +3,22 @@
 // RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-unknown %s -verify 
-fexceptions -fcxx-exceptions -pedantic-errors
 // RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown %s -verify 
-fexceptions -fcxx-exceptions -pedantic-errors
 // RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-unknown %s -verify 
-fexceptions -fcxx-exceptions -pedantic-errors
-// RUN: %clang_cc1 -std=c++2a -triple x86_64-unknown-unknown %s -verify 
-fexceptions -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-unknown %s -verify 
-fexceptions -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++2b -triple x86_64-unknown-unknown %s -verify 
-fexceptions -fcxx-exceptions -pedantic-errors
 
 #if __cplusplus < 201103L
 #define static_assert(...) _Static_assert(__VA_ARGS__)
 #endif
 
+namespace dr2007 { // dr2007: 3.4
+template struct A { typename T::error e; };
+template struct B { };
+B > b1;
+B > b2 = b1;
+int a = b2[0]; // expected-error {{does not provide a subscript operator}}
+int b = __builtin_addressof(b2)->foo; // expected-error {{no member}}
+}
+
 namespace dr2026 { // dr2026: 11
   template struct X {};
 


Index: clang/www/cxx_dr_status.html
===
--- clang/www/cxx_dr_status.html
+++ clang/www/cxx_dr_status.html
@@ -11849,7 +11849,7 @@
 https://wg21.link/cwg2007";>2007
 CD6
 Argument-dependent lookup for operator=
-Unknown
+Clang 3.4
   
   
 https://wg21.link/cwg2008";>2008
Index: clang/test/CXX/drs/dr20xx.cpp
===
--- clang/test/CXX/drs/dr20xx.cpp
+++ clang/test/CXX/drs/dr20xx.cpp
@@ -3,12 +3,22 @@
 // RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
 // RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
 // RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
-// RUN: %clang_cc1 -std=c++2a -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++2b -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
 
 #if __cplusplus < 201103L
 #define static_assert(...) _Static_assert(__VA_ARGS__)
 #endif
 
+namespace dr2007 { // dr2007: 3.4
+template struct A { typename T::error e; };
+template struct B { };
+B > b1;
+B > b2 = b1;
+int a = b2[0]; // expected-error {{does not provide a subscript operator}}
+int b = __builtin_addressof(b2)->foo; // expected-error {{no member}}
+}
+
 namespace dr2026 { // dr2026: 11
   template struct X {};
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D147839: [clang] Add test for CWG2007

2023-04-11 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill updated this revision to Diff 512543.
Endill added a comment.

rebase


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D147839/new/

https://reviews.llvm.org/D147839

Files:
  clang/test/CXX/drs/dr20xx.cpp
  clang/www/cxx_dr_status.html


Index: clang/www/cxx_dr_status.html
===
--- clang/www/cxx_dr_status.html
+++ clang/www/cxx_dr_status.html
@@ -11849,7 +11849,7 @@
 https://wg21.link/cwg2007";>2007
 CD6
 Argument-dependent lookup for operator=
-Unknown
+Clang 3.4
   
   
 https://wg21.link/cwg2008";>2008
Index: clang/test/CXX/drs/dr20xx.cpp
===
--- clang/test/CXX/drs/dr20xx.cpp
+++ clang/test/CXX/drs/dr20xx.cpp
@@ -3,12 +3,22 @@
 // RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-unknown %s -verify 
-fexceptions -fcxx-exceptions -pedantic-errors
 // RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown %s -verify 
-fexceptions -fcxx-exceptions -pedantic-errors
 // RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-unknown %s -verify 
-fexceptions -fcxx-exceptions -pedantic-errors
-// RUN: %clang_cc1 -std=c++2a -triple x86_64-unknown-unknown %s -verify 
-fexceptions -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-unknown %s -verify 
-fexceptions -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++2b -triple x86_64-unknown-unknown %s -verify 
-fexceptions -fcxx-exceptions -pedantic-errors
 
 #if __cplusplus < 201103L
 #define static_assert(...) _Static_assert(__VA_ARGS__)
 #endif
 
+namespace dr2007 { // dr2007: 3.4
+template struct A { typename T::error e; };
+template struct B { };
+B > b1;
+B > b2 = b1;
+int a = b2[0]; // expected-error {{does not provide a subscript operator}}
+int b = __builtin_addressof(b2)->foo; // expected-error {{no member}}
+}
+
 namespace dr2026 { // dr2026: 11
   template struct X {};
 


Index: clang/www/cxx_dr_status.html
===
--- clang/www/cxx_dr_status.html
+++ clang/www/cxx_dr_status.html
@@ -11849,7 +11849,7 @@
 https://wg21.link/cwg2007";>2007
 CD6
 Argument-dependent lookup for operator=
-Unknown
+Clang 3.4
   
   
 https://wg21.link/cwg2008";>2008
Index: clang/test/CXX/drs/dr20xx.cpp
===
--- clang/test/CXX/drs/dr20xx.cpp
+++ clang/test/CXX/drs/dr20xx.cpp
@@ -3,12 +3,22 @@
 // RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
 // RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
 // RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
-// RUN: %clang_cc1 -std=c++2a -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++2b -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
 
 #if __cplusplus < 201103L
 #define static_assert(...) _Static_assert(__VA_ARGS__)
 #endif
 
+namespace dr2007 { // dr2007: 3.4
+template struct A { typename T::error e; };
+template struct B { };
+B > b1;
+B > b2 = b1;
+int a = b2[0]; // expected-error {{does not provide a subscript operator}}
+int b = __builtin_addressof(b2)->foo; // expected-error {{no member}}
+}
+
 namespace dr2026 { // dr2026: 11
   template struct X {};
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D147848: [clang] Add test for CWG2370

2023-04-11 Thread Vlad Serebrennikov via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGfeb93d28b02c: [clang] Add test for CWG2370 (authored by 
Endill).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D147848/new/

https://reviews.llvm.org/D147848

Files:
  clang/test/CXX/drs/dr23xx.cpp
  clang/www/cxx_dr_status.html


Index: clang/www/cxx_dr_status.html
===
--- clang/www/cxx_dr_status.html
+++ clang/www/cxx_dr_status.html
@@ -14027,7 +14027,7 @@
 https://wg21.link/cwg2370";>2370
 CD6
 friend declarations of namespace-scope functions
-Unknown
+No
   
   
 https://wg21.link/cwg2371";>2371
Index: clang/test/CXX/drs/dr23xx.cpp
===
--- clang/test/CXX/drs/dr23xx.cpp
+++ clang/test/CXX/drs/dr23xx.cpp
@@ -2,7 +2,9 @@
 // RUN: %clang_cc1 -std=c++11 %s -verify -fexceptions -fcxx-exceptions 
-pedantic-errors 2>&1 | FileCheck %s
 // RUN: %clang_cc1 -std=c++14 %s -verify -fexceptions -fcxx-exceptions 
-pedantic-errors 2>&1 | FileCheck %s
 // RUN: %clang_cc1 -std=c++17 %s -verify -fexceptions -fcxx-exceptions 
-pedantic-errors 2>&1 | FileCheck %s
-// RUN: %clang_cc1 -std=c++2a %s -verify -fexceptions -fcxx-exceptions 
-pedantic-errors 2>&1 | FileCheck %s
+// RUN: %clang_cc1 -std=c++20 %s -verify -fexceptions -fcxx-exceptions 
-pedantic-errors 2>&1 | FileCheck %s
+// RUN: %clang_cc1 -std=c++2b %s -verify -fexceptions -fcxx-exceptions 
-pedantic-errors 2>&1 | FileCheck %s
+
 
 #if __cplusplus >= 201103L
 namespace dr2338 { // dr2338: 12
@@ -169,6 +171,20 @@
 } //namespace dr2303
 #endif
 
+namespace dr2370 { // dr2370: no
+namespace N {
+typedef int type;
+void g(type);
+void h(type);
+} // namespace N
+class C {
+  typedef N::type N_type;
+  // FIXME: `type` should be searched for in N
+  // friend void N::g(type);
+  friend void N::h(N_type);
+};
+} // namespace dr2370
+
 // dr2385: na
 
 namespace dr2394 { // dr2394: 15


Index: clang/www/cxx_dr_status.html
===
--- clang/www/cxx_dr_status.html
+++ clang/www/cxx_dr_status.html
@@ -14027,7 +14027,7 @@
 https://wg21.link/cwg2370";>2370
 CD6
 friend declarations of namespace-scope functions
-Unknown
+No
   
   
 https://wg21.link/cwg2371";>2371
Index: clang/test/CXX/drs/dr23xx.cpp
===
--- clang/test/CXX/drs/dr23xx.cpp
+++ clang/test/CXX/drs/dr23xx.cpp
@@ -2,7 +2,9 @@
 // RUN: %clang_cc1 -std=c++11 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors 2>&1 | FileCheck %s
 // RUN: %clang_cc1 -std=c++14 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors 2>&1 | FileCheck %s
 // RUN: %clang_cc1 -std=c++17 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors 2>&1 | FileCheck %s
-// RUN: %clang_cc1 -std=c++2a %s -verify -fexceptions -fcxx-exceptions -pedantic-errors 2>&1 | FileCheck %s
+// RUN: %clang_cc1 -std=c++20 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors 2>&1 | FileCheck %s
+// RUN: %clang_cc1 -std=c++2b %s -verify -fexceptions -fcxx-exceptions -pedantic-errors 2>&1 | FileCheck %s
+
 
 #if __cplusplus >= 201103L
 namespace dr2338 { // dr2338: 12
@@ -169,6 +171,20 @@
 } //namespace dr2303
 #endif
 
+namespace dr2370 { // dr2370: no
+namespace N {
+typedef int type;
+void g(type);
+void h(type);
+} // namespace N
+class C {
+  typedef N::type N_type;
+  // FIXME: `type` should be searched for in N
+  // friend void N::g(type);
+  friend void N::h(N_type);
+};
+} // namespace dr2370
+
 // dr2385: na
 
 namespace dr2394 { // dr2394: 15
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D148035: [clang] Add test for CWG1837

2023-04-11 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill updated this revision to Diff 512538.
Endill added a comment.

minor fix


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D148035/new/

https://reviews.llvm.org/D148035

Files:
  clang/test/CXX/drs/dr18xx.cpp
  clang/www/cxx_dr_status.html


Index: clang/www/cxx_dr_status.html
===
--- clang/www/cxx_dr_status.html
+++ clang/www/cxx_dr_status.html
@@ -10829,7 +10829,7 @@
 https://wg21.link/cwg1837";>1837
 CD6
 Use of this in friend and local class 
declarations
-Unknown
+Clang 3.3
   
   
 https://wg21.link/cwg1838";>1838
Index: clang/test/CXX/drs/dr18xx.cpp
===
--- clang/test/CXX/drs/dr18xx.cpp
+++ clang/test/CXX/drs/dr18xx.cpp
@@ -2,7 +2,8 @@
 // RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-unknown %s -verify 
-fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
 // RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown %s -verify 
-fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
 // RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-unknown %s -verify 
-fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
-// RUN: %clang_cc1 -std=c++2a -triple x86_64-unknown-unknown %s -verify 
-fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-unknown %s -verify 
-fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++2b -triple x86_64-unknown-unknown %s -verify 
-fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
 
 #if __cplusplus < 201103L
 // expected-error@+1 {{variadic macro}}
@@ -59,6 +60,43 @@
 #endif
 }
 
+namespace dr1837 { // dr1837: 3.3
+#if __cplusplus >= 201103L
+  template 
+  struct Fish { static const bool value = true; };
+
+  struct Other {
+int p();
+auto q() -> decltype(p()) *;
+  };
+
+  class Outer {
+friend auto Other::q() -> decltype(this->p()) *; // expected-error 
{{invalid use of 'this'}}
+int g();
+int f() {
+  extern void f(decltype(this->g()) *);
+  struct Inner {
+static_assert(Fishg())>::value, ""); // expected-error 
{{invalid use of 'this'}}
+enum { X = Fishf())>::value }; // expected-error 
{{invalid use of 'this'}}
+struct Inner2 : Fishg())> { }; // expected-error 
{{invalid use of 'this'}}
+friend void f(decltype(this->g()) *); // expected-error {{invalid use 
of 'this'}}
+friend auto Other::q() -> decltype(this->p()) *; // expected-error 
{{invalid use of 'this'}}
+  };
+  return 0;
+}
+  };
+
+  struct A {
+int f();
+bool b = [] {
+  struct Local {
+static_assert(sizeof(this->f()) == sizeof(int), "");
+  };
+};
+  };
+#endif
+}
+
 namespace dr1872 { // dr1872: 9
 #if __cplusplus >= 201103L
   template struct A : T {


Index: clang/www/cxx_dr_status.html
===
--- clang/www/cxx_dr_status.html
+++ clang/www/cxx_dr_status.html
@@ -10829,7 +10829,7 @@
 https://wg21.link/cwg1837";>1837
 CD6
 Use of this in friend and local class declarations
-Unknown
+Clang 3.3
   
   
 https://wg21.link/cwg1838";>1838
Index: clang/test/CXX/drs/dr18xx.cpp
===
--- clang/test/CXX/drs/dr18xx.cpp
+++ clang/test/CXX/drs/dr18xx.cpp
@@ -2,7 +2,8 @@
 // RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-unknown %s -verify -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
 // RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown %s -verify -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
 // RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-unknown %s -verify -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
-// RUN: %clang_cc1 -std=c++2a -triple x86_64-unknown-unknown %s -verify -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-unknown %s -verify -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++2b -triple x86_64-unknown-unknown %s -verify -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
 
 #if __cplusplus < 201103L
 // expected-error@+1 {{variadic macro}}
@@ -59,6 +60,43 @@
 #endif
 }
 
+namespace dr1837 { // dr1837: 3.3
+#if __cplusplus >= 201103L
+  template 
+  struct Fish { static const bool value = true; };
+
+  struct Other {
+int p();
+auto q() -> decltype(p()) *;
+  };
+
+  class Outer {
+friend auto Other::q() -> decltype(this->p()) *; // expected-error {{invalid use of 'this'}}
+int g();
+int f() {
+  extern void f(decltype(this->g()) *);
+  struct Inner {
+static_assert(Fishg())>::value, ""); /

[PATCH] D148035: [clang] Add test for CWG1837

2023-04-11 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill created this revision.
Endill added a reviewer: clang-language-wg.
Herald added a project: All.
Endill requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

P1787 : CWG1837 is resolved by restricting this to 
referring to the innermost enclosing class.
Wording: see changes to [expr.prim.this] and [expr.prim.lambda]


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D148035

Files:
  clang/test/CXX/drs/dr18xx.cpp
  clang/www/cxx_dr_status.html


Index: clang/www/cxx_dr_status.html
===
--- clang/www/cxx_dr_status.html
+++ clang/www/cxx_dr_status.html
@@ -10829,7 +10829,7 @@
 https://wg21.link/cwg1837";>1837
 CD6
 Use of this in friend and local class 
declarations
-Unknown
+Clang 3.3
   
   
 https://wg21.link/cwg1838";>1838
Index: clang/test/CXX/drs/dr18xx.cpp
===
--- clang/test/CXX/drs/dr18xx.cpp
+++ clang/test/CXX/drs/dr18xx.cpp
@@ -2,7 +2,8 @@
 // RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-unknown %s -verify 
-fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
 // RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown %s -verify 
-fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
 // RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-unknown %s -verify 
-fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
-// RUN: %clang_cc1 -std=c++2a -triple x86_64-unknown-unknown %s -verify 
-fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-unknown %s -verify 
-fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++2b -triple x86_64-unknown-unknown %s -verify 
-fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
 
 #if __cplusplus < 201103L
 // expected-error@+1 {{variadic macro}}
@@ -59,6 +60,43 @@
 #endif
 }
 
+namespace dr1837 { // dr1837: 3.3
+#if __cplusplus >= 201103L
+  template 
+  struct Fish { static const bool value = true; };
+
+  struct Other {
+int p();
+auto q() -> decltype(p()) *;
+  };
+
+  class Outer {
+friend auto Other::q() -> decltype(this->p()) *; // expected-error 
{{invalid use of 'this'}}
+int g();
+int f() {
+  extern void f(decltype(this->g()) *);
+  struct Inner {
+static_assert(Fishg())>::value, ""); // expected-error 
{{invalid use of 'this'}}
+enum { X = Fishf())>::value }; // expected-error 
{{invalid use of 'this'}}
+struct Inner2 : Fishg())> { }; // expected-error 
{{invalid use of 'this'}}
+friend void f(decltype(this->g()) *); // expected-error {{invalid use 
of 'this'}}
+friend auto Other::q() -> decltype(this->p()) *; // expected-error 
{{invalid use of 'this'}}
+  };
+  return 0;
+}
+  };
+
+  struct A {
+int f();
+auto b = [] {
+  struct Local {
+static_assert(sizeof(this->f()) == sizeof(int), "");
+  };
+};
+  };
+#endif
+}
+
 namespace dr1872 { // dr1872: 9
 #if __cplusplus >= 201103L
   template struct A : T {


Index: clang/www/cxx_dr_status.html
===
--- clang/www/cxx_dr_status.html
+++ clang/www/cxx_dr_status.html
@@ -10829,7 +10829,7 @@
 https://wg21.link/cwg1837";>1837
 CD6
 Use of this in friend and local class declarations
-Unknown
+Clang 3.3
   
   
 https://wg21.link/cwg1838";>1838
Index: clang/test/CXX/drs/dr18xx.cpp
===
--- clang/test/CXX/drs/dr18xx.cpp
+++ clang/test/CXX/drs/dr18xx.cpp
@@ -2,7 +2,8 @@
 // RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-unknown %s -verify -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
 // RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown %s -verify -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
 // RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-unknown %s -verify -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
-// RUN: %clang_cc1 -std=c++2a -triple x86_64-unknown-unknown %s -verify -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-unknown %s -verify -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++2b -triple x86_64-unknown-unknown %s -verify -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
 
 #if __cplusplus < 201103L
 // expected-error@+1 {{variadic macro}}
@@ -59,6 +60,43 @@
 #endif
 }
 
+namespace dr1837 { // dr1837: 3.3
+#if __cplusplus >= 201103L
+  template 
+  struct Fish { static const bool value = true; };
+
+  struct Other {
+int p();
+auto q() -> decltype(p()) *;
+  };
+
+  

[PATCH] D147920: [clang] Add test for CWG399

2023-04-11 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill added inline comments.



Comment at: clang/test/CXX/drs/dr3xx.cpp:1439
+
+namespace dr399 { // dr399: 11
+  // NB: reuse dr244 test 

shafik wrote:
> Endill wrote:
> > Despite a couple of FIXME in CWG244 test (out of dozens of examples), it 
> > claims full availability since Clang 11. I'd take a more conservative 
> > approach, declaring partial support, but I think that declaring different 
> > availability for the same test would bring unnecessary confusion. So I 
> > followed CWG244 availability.
> > 
> > Alternative is to demote CWG244 to partial, but I'm not sure we should go 
> > back on our claims for CWG support that has been out for so long.
> I think the bugs are not awful, we should file bug reports if we don't 
> already have them. Some of them seem like they should be not too bad to fix.
> 
> CC @aaron.ballman to get a second opinion
If we are to file bug reports, I'm not sure what wording makes those examples 
ill-formed. Is it [[ http://eel.is/c++draft/basic.lookup#qual.general-4.6 | 
qual.general-4.6 ]]: `The type-name that is or contains Q shall refer to its 
(original) lookup context (ignoring cv-qualification) under the interpretation 
established by at least one (successful) lookup performed.`? I interpret it as 
requiring names to the left and to the right of `~` to be found in the same 
scope (lookup context; `namespace dr244` in our case). Could it actually mean 
that they have to refer to the same type?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D147920/new/

https://reviews.llvm.org/D147920

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D147920: [clang] Add test for CWG399

2023-04-11 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill added a comment.

In D147920#4258680 , @shafik wrote:

> In D147920#4257369 , @Endill wrote:
>
>> I think I haven't stressed it enough, but this whole test is copied from 
>> dr244, which is written by Richard.
>
> Understood, I appreciate the patience in explaining what I am missing. 
> Sometimes that means things could be explained better.

No worries. Those DRs are involved enough that it could be challenging to 
understand the context quickly.




Comment at: clang/test/CXX/drs/dr3xx.cpp:1492
+// This is technically ill-formed; G is looked up in 'N::' and is not 
found.
+// Rejecting this seems correct, but most compilers accept, so we do also.
+f.N::F::~G(); // expected-error {{qualified destructor name only found in 
lexical scope; omit the qualifier to find this type name by unqualified lookup}}

shafik wrote:
> Endill wrote:
> > shafik wrote:
> > > You say we accept the next line but it has an `expected-error` on it?
> > It's an error because of `-pedantic-errors`. It's a warning by default.
> That makes a lot more sense, I was wondering what was I missing.
> 
> Can we note that in the comment b/c it is pretty confusing otherwise. 
> 
> I wonder if there is a good reason to not make this ill-formed by default? 
> Worth a bug report.
> Can we note that in the comment b/c it is pretty confusing otherwise.

I get where you come from, but all DR testing is done under `-pedantic-errors`. 
Do you have ideas for a more systematic approach? One of the options is to use 
`-Wpedantic` instead, but I expect that to require a decent amount of 
mechanical replacements for existing tests, which LLVM community doesn't 
appreciate, as far as I know. I'll edit the comment if we won't come up with 
something better.

> I wonder if there is a good reason to not make this ill-formed by default? 
> Worth a bug report.

Does the fact that we accepted such code since (at least) 3.5 through 10 make 
for a good reason? https://godbolt.org/z/16GYWh3Po


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D147920/new/

https://reviews.llvm.org/D147920

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D147839: [clang] Add test for CWG2007

2023-04-11 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill added a comment.

In D147839#4258681 , @shafik wrote:

> In D147839#4257394 , @Endill wrote:
>
>> Replace unary `&` with `__builtin_addressof()`. It prevents unnecessary 
>> template instantiation (presumably to find overloaded unary `&`), and make 
>> Clang compliant since 3.4
>
> Nice approach!

Credits go to Aaron, actually. We discussed this DR during his office hours 
yesterday.

In D147839#4258682 , @shafik wrote:

> LGTM, thank you again for all the effort in documenting these and adding 
> tests, it is much appreciated.

Thank you for giving them thorough review.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D147839/new/

https://reviews.llvm.org/D147839

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D147909: [clang] Implement CWG 2397

2023-04-11 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill added a comment.

Agree, this test clearly belongs to `clang/test/CXX/drs/dr23xx.cpp`.
There is a `clang/www/make_cxx_dr_status` script to update cxx_dr_status page, 
so you don't have to edit it manually.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D147909/new/

https://reviews.llvm.org/D147909

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D147848: [clang] Add test for CWG2370

2023-04-11 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill added a comment.

Bug report filed: https://github.com/llvm/llvm-project/issues/62061


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D147848/new/

https://reviews.llvm.org/D147848

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D147839: [clang] Add test for CWG2007

2023-04-11 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill updated this revision to Diff 512365.
Endill added a comment.

Replace unary `&` with `__builtin_addressof()`. It prevents unnecessary 
template instantiation (presumably to find overloaded unary `&`), and make 
Clang compliant since 3.4


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D147839/new/

https://reviews.llvm.org/D147839

Files:
  clang/test/CXX/drs/dr20xx.cpp
  clang/www/cxx_dr_status.html


Index: clang/www/cxx_dr_status.html
===
--- clang/www/cxx_dr_status.html
+++ clang/www/cxx_dr_status.html
@@ -11849,7 +11849,7 @@
 https://wg21.link/cwg2007";>2007
 CD6
 Argument-dependent lookup for operator=
-Partial
+Clang 3.4
   
   
 https://wg21.link/cwg2008";>2008
Index: clang/test/CXX/drs/dr20xx.cpp
===
--- clang/test/CXX/drs/dr20xx.cpp
+++ clang/test/CXX/drs/dr20xx.cpp
@@ -10,14 +10,13 @@
 #define static_assert(...) _Static_assert(__VA_ARGS__)
 #endif
 
-namespace dr2007 { // dr2007: partial
+namespace dr2007 { // dr2007: 3.4
 template struct A { typename T::error e; };
 template struct B { };
 B > b1;
 B > b2 = b1;
 int a = b2[0]; // expected-error {{does not provide a subscript operator}}
-// FIXME: the following code shouldn't instantiate A.
-// int b = (&b2)->foo;
+int b = __builtin_addressof(b2)->foo; // expected-error {{no member}}
 }
 
 namespace dr2026 { // dr2026: 11


Index: clang/www/cxx_dr_status.html
===
--- clang/www/cxx_dr_status.html
+++ clang/www/cxx_dr_status.html
@@ -11849,7 +11849,7 @@
 https://wg21.link/cwg2007";>2007
 CD6
 Argument-dependent lookup for operator=
-Partial
+Clang 3.4
   
   
 https://wg21.link/cwg2008";>2008
Index: clang/test/CXX/drs/dr20xx.cpp
===
--- clang/test/CXX/drs/dr20xx.cpp
+++ clang/test/CXX/drs/dr20xx.cpp
@@ -10,14 +10,13 @@
 #define static_assert(...) _Static_assert(__VA_ARGS__)
 #endif
 
-namespace dr2007 { // dr2007: partial
+namespace dr2007 { // dr2007: 3.4
 template struct A { typename T::error e; };
 template struct B { };
 B > b1;
 B > b2 = b1;
 int a = b2[0]; // expected-error {{does not provide a subscript operator}}
-// FIXME: the following code shouldn't instantiate A.
-// int b = (&b2)->foo;
+int b = __builtin_addressof(b2)->foo; // expected-error {{no member}}
 }
 
 namespace dr2026 { // dr2026: 11
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D147920: [clang] Add test for CWG399

2023-04-11 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill added a comment.

I think I haven't stressed it enough, but this whole test is copied from dr244, 
which is written by Richard.




Comment at: clang/test/CXX/drs/dr3xx.cpp:1492
+// This is technically ill-formed; G is looked up in 'N::' and is not 
found.
+// Rejecting this seems correct, but most compilers accept, so we do also.
+f.N::F::~G(); // expected-error {{qualified destructor name only found in 
lexical scope; omit the qualifier to find this type name by unqualified lookup}}

shafik wrote:
> You say we accept the next line but it has an `expected-error` on it?
It's an error because of `-pedantic-errors`. It's a warning by default.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D147920/new/

https://reviews.llvm.org/D147920

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D147848: [clang] Add test for CWG2370

2023-04-11 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill added inline comments.



Comment at: clang/test/CXX/drs/dr23xx.cpp:182
+  typedef N::type N_type;
+  // FIXME: `type` should be searched for in N
+  // friend void N::g(type);

shafik wrote:
> The implementation seems to all accept this example: 
> https://godbolt.org/z/vE6bEP6xa
> 
> but the examples from the `p1787` have a decidely mixed conformance: 
> https://godbolt.org/z/dhq7oEKaY
> 
> but the `A::F(F)` you point out in your example clang does get wrong and gcc 
> does not. So at minimum please file bug reports against the examples that 
> clang does not get right from `p1787` and we need to dig into why your 
> example above seems to not the same since that is what you intended. 
Are you sure behavior is different for my `N::g(type)` when compared to 
`A::f(F)`? Clang is the only one to reject both examples: 
https://godbolt.org/z/MKb6fE8K5


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D147848/new/

https://reviews.llvm.org/D147848

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D147836: [clang] Add test for CWG1822

2023-04-11 Thread Vlad Serebrennikov via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG86946ebb796c: [clang] Add test for CWG1822 (authored by 
Endill).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D147836/new/

https://reviews.llvm.org/D147836

Files:
  clang/test/CXX/drs/dr18xx.cpp
  clang/www/cxx_dr_status.html


Index: clang/www/cxx_dr_status.html
===
--- clang/www/cxx_dr_status.html
+++ clang/www/cxx_dr_status.html
@@ -10739,7 +10739,7 @@
 https://wg21.link/cwg1822";>1822
 CD6
 Lookup of parameter names in lambda-expressions
-Unknown
+Yes
   
   
 https://wg21.link/cwg1823";>1823
Index: clang/test/CXX/drs/dr18xx.cpp
===
--- clang/test/CXX/drs/dr18xx.cpp
+++ clang/test/CXX/drs/dr18xx.cpp
@@ -50,6 +50,15 @@
 #endif
 }
 
+namespace dr1822 { // dr1822: yes
+#if __cplusplus >= 201103L
+  int a;
+  auto x = [] (int a) {
+#pragma clang __debug dump a // CHECK: ParmVarDecl
+  };
+#endif
+}
+
 namespace dr1872 { // dr1872: 9
 #if __cplusplus >= 201103L
   template struct A : T {


Index: clang/www/cxx_dr_status.html
===
--- clang/www/cxx_dr_status.html
+++ clang/www/cxx_dr_status.html
@@ -10739,7 +10739,7 @@
 https://wg21.link/cwg1822";>1822
 CD6
 Lookup of parameter names in lambda-expressions
-Unknown
+Yes
   
   
 https://wg21.link/cwg1823";>1823
Index: clang/test/CXX/drs/dr18xx.cpp
===
--- clang/test/CXX/drs/dr18xx.cpp
+++ clang/test/CXX/drs/dr18xx.cpp
@@ -50,6 +50,15 @@
 #endif
 }
 
+namespace dr1822 { // dr1822: yes
+#if __cplusplus >= 201103L
+  int a;
+  auto x = [] (int a) {
+#pragma clang __debug dump a // CHECK: ParmVarDecl
+  };
+#endif
+}
+
 namespace dr1872 { // dr1872: 9
 #if __cplusplus >= 201103L
   template struct A : T {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D147839: [clang] Add test for CWG2007

2023-04-10 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill added inline comments.



Comment at: clang/test/CXX/drs/dr20xx.cpp:20
+// FIXME: the following code shouldn't instantiate A.
+// int b = (&b2)->foo;
+}

shafik wrote:
> shafik wrote:
> > It looks like gcc and MSVC also instantiate `A` for this case: 
> > https://godbolt.org/z/8W8eYoa38
> > 
> > I have to think about it some more but if we believe clang is wrong here, 
> > you should file a bug report.
> I think [unary &](https://eel.is/c++draft/over.match.oper#3.3) is triggering 
> the instantiation. 
Does it mean that we should craft a better example?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D147839/new/

https://reviews.llvm.org/D147839

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D147564: [clang] Mark CWG536 as N/A

2023-04-10 Thread Vlad Serebrennikov via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG6737a1520900: [clang] Mark CWG536 as N/A (authored by 
Endill).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D147564/new/

https://reviews.llvm.org/D147564

Files:
  clang/test/CXX/drs/dr5xx.cpp
  clang/www/cxx_dr_status.html


Index: clang/www/cxx_dr_status.html
===
--- clang/www/cxx_dr_status.html
+++ clang/www/cxx_dr_status.html
@@ -3255,7 +3255,7 @@
 https://wg21.link/cwg536";>536
 CD6
 Problems in the description of id-expressions
-Unknown
+N/A
   
   
 https://wg21.link/cwg537";>537
Index: clang/test/CXX/drs/dr5xx.cpp
===
--- clang/test/CXX/drs/dr5xx.cpp
+++ clang/test/CXX/drs/dr5xx.cpp
@@ -418,6 +418,7 @@
 #endif
 }
 
+// dr536: na
 // dr537: na
 // dr538: na
 


Index: clang/www/cxx_dr_status.html
===
--- clang/www/cxx_dr_status.html
+++ clang/www/cxx_dr_status.html
@@ -3255,7 +3255,7 @@
 https://wg21.link/cwg536";>536
 CD6
 Problems in the description of id-expressions
-Unknown
+N/A
   
   
 https://wg21.link/cwg537";>537
Index: clang/test/CXX/drs/dr5xx.cpp
===
--- clang/test/CXX/drs/dr5xx.cpp
+++ clang/test/CXX/drs/dr5xx.cpp
@@ -418,6 +418,7 @@
 #endif
 }
 
+// dr536: na
 // dr537: na
 // dr538: na
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D147920: [clang] Add test for CWG399

2023-04-10 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill added inline comments.



Comment at: clang/test/CXX/drs/dr3xx.cpp:1439
+
+namespace dr399 { // dr399: 11
+  // NB: reuse dr244 test 

Despite a couple of FIXME in CWG244 test (out of dozens of examples), it claims 
full availability since Clang 11. I'd take a more conservative approach, 
declaring partial support, but I think that declaring different availability 
for the same test would bring unnecessary confusion. So I followed CWG244 
availability.

Alternative is to demote CWG244 to partial, but I'm not sure we should go back 
on our claims for CWG support that has been out for so long.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D147920/new/

https://reviews.llvm.org/D147920

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D147920: [clang] Add test for CWG399

2023-04-10 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill created this revision.
Endill added a reviewer: clang-language-wg.
Herald added a project: All.
Endill requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

P1787 : CWG399 is resolved by explicitly appealing to 
the lookup for the last component of any suitable nested-name-specifier.
Wording: Otherwise, its nested-name-specifier N shall nominate a type. If N has 
another nested-name-specifier S, Q is looked up as if its lookup context were 
that nominated by S. ([basic.lookup.qual]/6.2)

CWG399 revisits a resolution to older CWG244. Our test for CWG244 covers many 
examples from CWG399, and it was updated in 2020 presumably aware of P1787 
, so I reused CWG244 test. This approach to 
reusing was discussed in a CWG405 patch review 
.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D147920

Files:
  clang/test/CXX/drs/dr2xx.cpp
  clang/test/CXX/drs/dr3xx.cpp
  clang/www/cxx_dr_status.html

Index: clang/www/cxx_dr_status.html
===
--- clang/www/cxx_dr_status.html
+++ clang/www/cxx_dr_status.html
@@ -2433,7 +2433,7 @@
 https://wg21.link/cwg399";>399
 CD6
 Destructor lookup redux
-Unknown
+Clang 11
   
   
 https://wg21.link/cwg400";>400
Index: clang/test/CXX/drs/dr3xx.cpp
===
--- clang/test/CXX/drs/dr3xx.cpp
+++ clang/test/CXX/drs/dr3xx.cpp
@@ -1435,3 +1435,83 @@
 }
   }
 }
+
+namespace dr399 { // dr399: 11
+  // NB: reuse dr244 test 
+  struct B {}; // expected-note {{type 'dr244::B' found by destructor name lookup}}
+  struct D : B {};
+
+  D D_object;
+  typedef B B_alias;
+  B* B_ptr = &D_object;
+
+  void f() {
+D_object.~B(); // expected-error {{does not match the type 'D' of the object being destroyed}}
+D_object.B::~B();
+D_object.D::~B(); // FIXME: Missing diagnostic for this.
+B_ptr->~B();
+B_ptr->~B_alias();
+B_ptr->B_alias::~B();
+B_ptr->B_alias::~B_alias();
+B_ptr->dr244::~B(); // expected-error {{refers to a member in namespace}}
+B_ptr->dr244::~B_alias(); // expected-error {{refers to a member in namespace}}
+  }
+
+  template
+  void f(T *B_ptr, U D_object) {
+D_object.~B(); // FIXME: Missing diagnostic for this.
+D_object.B::~B();
+D_object.D::~B(); // FIXME: Missing diagnostic for this.
+B_ptr->~B();
+B_ptr->~B_alias();
+B_ptr->B_alias::~B();
+B_ptr->B_alias::~B_alias();
+B_ptr->dr399::~B(); // expected-error {{does not refer to a type name}}
+B_ptr->dr399::~B_alias(); // expected-error {{does not refer to a type name}}
+  }
+  template void f(B*, D);
+
+  namespace N {
+template struct E {};
+typedef E F;
+  }
+  void g(N::F f) {
+typedef N::F G; // expected-note {{found by destructor name lookup}}
+f.~G();
+f.G::~E(); // expected-error {{ISO C++ requires the name after '::~' to be found in the same scope as the name before '::~'}}
+f.G::~F(); // expected-error {{undeclared identifier 'F' in destructor name}}
+f.G::~G();
+// This is technically ill-formed; E is looked up in 'N::' and names the
+// class template, not the injected-class-name of the class. But that's
+// probably a bug in the standard.
+f.N::F::~E(); // expected-error {{ISO C++ requires the name after '::~' to be found in the same scope as the name before '::~'}}
+// This is valid; we look up the second F in the same scope in which we
+// found the first one, that is, 'N::'.
+f.N::F::~F();
+// This is technically ill-formed; G is looked up in 'N::' and is not found.
+// Rejecting this seems correct, but most compilers accept, so we do also.
+f.N::F::~G(); // expected-error {{qualified destructor name only found in lexical scope; omit the qualifier to find this type name by unqualified lookup}}
+  }
+
+  // Bizarrely, compilers perform lookup in the scope for qualified destructor
+  // names, if the nested-name-specifier is non-dependent. Ensure we diagnose
+  // this.
+  namespace QualifiedLookupInScope {
+namespace N {
+  template  struct S { struct Inner {}; };
+}
+template  void f(typename N::S::Inner *p) {
+  typedef typename N::S::Inner T;
+  p->::dr399::QualifiedLookupInScope::N::S::Inner::~T(); // expected-error {{no type named 'T' in}}
+}
+template void f(N::S::Inner *); // expected-note {{instantiation of}}
+
+template  void g(U *p) {
+  typedef U T;
+  p->T::~T();
+  p->U::~T();
+  p->::dr399::QualifiedLookupInScope::N::S::Inner::~T(); // expected-error {{'T' does not refer to a type name}}
+}
+template void g(N::S::Inner *);
+  }
+}
Index: clang/test/CXX/drs/dr2xx.cpp
===
--- clang/test/CXX/drs/dr2xx.cpp
+++ clang/test/CXX/

[PATCH] D147848: [clang] Add test for CWG2370

2023-04-08 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill created this revision.
Endill added a reviewer: clang-language-wg.
Herald added a project: All.
Endill requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

P1787 : CWG2370 is resolved by performing a search in 
(only) the immediate scope of any friend, per the CWG opinion from San Diego 
.
Wording: In a friend declaration declarator whose declarator-id is a 
qualified-id whose lookup context is a class or namespace S, lookup for an 
unqualified name that appears after the declarator-id performs a search in the 
scope associated with S. If that lookup finds nothing, it undergoes unqualified 
name lookup. ([basic.lookup.unqual]/6).

Clarification for P1787  description: when 
applied to the test in this patch, "immediate scope" refers to `N`, and 
"(only)" refers to the fact that `type` is not searched in parent scope of `N`. 
See example after the wording if additional clarification is needed. The most 
relevant line there is `friend void A::f(F);  // OK`.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D147848

Files:
  clang/test/CXX/drs/dr23xx.cpp
  clang/www/cxx_dr_status.html


Index: clang/www/cxx_dr_status.html
===
--- clang/www/cxx_dr_status.html
+++ clang/www/cxx_dr_status.html
@@ -14027,7 +14027,7 @@
 https://wg21.link/cwg2370";>2370
 CD6
 friend declarations of namespace-scope functions
-Unknown
+No
   
   
 https://wg21.link/cwg2371";>2371
Index: clang/test/CXX/drs/dr23xx.cpp
===
--- clang/test/CXX/drs/dr23xx.cpp
+++ clang/test/CXX/drs/dr23xx.cpp
@@ -2,7 +2,9 @@
 // RUN: %clang_cc1 -std=c++11 %s -verify -fexceptions -fcxx-exceptions 
-pedantic-errors 2>&1 | FileCheck %s
 // RUN: %clang_cc1 -std=c++14 %s -verify -fexceptions -fcxx-exceptions 
-pedantic-errors 2>&1 | FileCheck %s
 // RUN: %clang_cc1 -std=c++17 %s -verify -fexceptions -fcxx-exceptions 
-pedantic-errors 2>&1 | FileCheck %s
-// RUN: %clang_cc1 -std=c++2a %s -verify -fexceptions -fcxx-exceptions 
-pedantic-errors 2>&1 | FileCheck %s
+// RUN: %clang_cc1 -std=c++20 %s -verify -fexceptions -fcxx-exceptions 
-pedantic-errors 2>&1 | FileCheck %s
+// RUN: %clang_cc1 -std=c++2b %s -verify -fexceptions -fcxx-exceptions 
-pedantic-errors 2>&1 | FileCheck %s
+
 
 #if __cplusplus >= 201103L
 namespace dr2338 { // dr2338: 12
@@ -169,6 +171,20 @@
 } //namespace dr2303
 #endif
 
+namespace dr2370 { // dr2370: no
+namespace N {
+typedef int type;
+void g(type);
+void h(type);
+} // namespace N
+class C {
+  typedef N::type N_type;
+  // FIXME: `type` should be searched for in N
+  // friend void N::g(type);
+  friend void N::h(N_type);
+};
+} // namespace dr2370
+
 // dr2385: na
 
 namespace dr2394 { // dr2394: 15


Index: clang/www/cxx_dr_status.html
===
--- clang/www/cxx_dr_status.html
+++ clang/www/cxx_dr_status.html
@@ -14027,7 +14027,7 @@
 https://wg21.link/cwg2370";>2370
 CD6
 friend declarations of namespace-scope functions
-Unknown
+No
   
   
 https://wg21.link/cwg2371";>2371
Index: clang/test/CXX/drs/dr23xx.cpp
===
--- clang/test/CXX/drs/dr23xx.cpp
+++ clang/test/CXX/drs/dr23xx.cpp
@@ -2,7 +2,9 @@
 // RUN: %clang_cc1 -std=c++11 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors 2>&1 | FileCheck %s
 // RUN: %clang_cc1 -std=c++14 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors 2>&1 | FileCheck %s
 // RUN: %clang_cc1 -std=c++17 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors 2>&1 | FileCheck %s
-// RUN: %clang_cc1 -std=c++2a %s -verify -fexceptions -fcxx-exceptions -pedantic-errors 2>&1 | FileCheck %s
+// RUN: %clang_cc1 -std=c++20 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors 2>&1 | FileCheck %s
+// RUN: %clang_cc1 -std=c++2b %s -verify -fexceptions -fcxx-exceptions -pedantic-errors 2>&1 | FileCheck %s
+
 
 #if __cplusplus >= 201103L
 namespace dr2338 { // dr2338: 12
@@ -169,6 +171,20 @@
 } //namespace dr2303
 #endif
 
+namespace dr2370 { // dr2370: no
+namespace N {
+typedef int type;
+void g(type);
+void h(type);
+} // namespace N
+class C {
+  typedef N::type N_type;
+  // FIXME: `type` should be searched for in N
+  // friend void N::g(type);
+  friend void N::h(N_type);
+};
+} // namespace dr2370
+
 // dr2385: na
 
 namespace dr2394 { // dr2394: 15
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D147839: [clang] Add test for CWG2007

2023-04-07 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill created this revision.
Endill added a reviewer: clang-language-wg.
Herald added a project: All.
Endill requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

P1787 : CWG2007 is resolved by skipping unqualified 
lookup for operators that must be member functions.
Wording: For the operators =, [], or ->, the set of non-member candidates is 
empty; otherwise, it includes the result of the unqualified lookup for 
operator@... ([over.match.oper]/3)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D147839

Files:
  clang/test/CXX/drs/dr20xx.cpp
  clang/www/cxx_dr_status.html


Index: clang/www/cxx_dr_status.html
===
--- clang/www/cxx_dr_status.html
+++ clang/www/cxx_dr_status.html
@@ -11849,7 +11849,7 @@
 https://wg21.link/cwg2007";>2007
 CD6
 Argument-dependent lookup for operator=
-Unknown
+Partial
   
   
 https://wg21.link/cwg2008";>2008
Index: clang/test/CXX/drs/dr20xx.cpp
===
--- clang/test/CXX/drs/dr20xx.cpp
+++ clang/test/CXX/drs/dr20xx.cpp
@@ -3,12 +3,23 @@
 // RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-unknown %s -verify 
-fexceptions -fcxx-exceptions -pedantic-errors
 // RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown %s -verify 
-fexceptions -fcxx-exceptions -pedantic-errors
 // RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-unknown %s -verify 
-fexceptions -fcxx-exceptions -pedantic-errors
-// RUN: %clang_cc1 -std=c++2a -triple x86_64-unknown-unknown %s -verify 
-fexceptions -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-unknown %s -verify 
-fexceptions -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++2b -triple x86_64-unknown-unknown %s -verify 
-fexceptions -fcxx-exceptions -pedantic-errors
 
 #if __cplusplus < 201103L
 #define static_assert(...) _Static_assert(__VA_ARGS__)
 #endif
 
+namespace dr2007 { // dr2007: partial
+template struct A { typename T::error e; };
+template struct B { };
+B > b1;
+B > b2 = b1;
+int a = b2[0]; // expected-error {{does not provide a subscript operator}}
+// FIXME: the following code shouldn't instantiate A.
+// int b = (&b2)->foo;
+}
+
 namespace dr2026 { // dr2026: 11
   template struct X {};
 


Index: clang/www/cxx_dr_status.html
===
--- clang/www/cxx_dr_status.html
+++ clang/www/cxx_dr_status.html
@@ -11849,7 +11849,7 @@
 https://wg21.link/cwg2007";>2007
 CD6
 Argument-dependent lookup for operator=
-Unknown
+Partial
   
   
 https://wg21.link/cwg2008";>2008
Index: clang/test/CXX/drs/dr20xx.cpp
===
--- clang/test/CXX/drs/dr20xx.cpp
+++ clang/test/CXX/drs/dr20xx.cpp
@@ -3,12 +3,23 @@
 // RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
 // RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
 // RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
-// RUN: %clang_cc1 -std=c++2a -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++2b -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
 
 #if __cplusplus < 201103L
 #define static_assert(...) _Static_assert(__VA_ARGS__)
 #endif
 
+namespace dr2007 { // dr2007: partial
+template struct A { typename T::error e; };
+template struct B { };
+B > b1;
+B > b2 = b1;
+int a = b2[0]; // expected-error {{does not provide a subscript operator}}
+// FIXME: the following code shouldn't instantiate A.
+// int b = (&b2)->foo;
+}
+
 namespace dr2026 { // dr2026: 11
   template struct X {};
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


  1   2   3   >