File tree Expand file tree Collapse file tree 5 files changed +43
-7
lines changed Expand file tree Collapse file tree 5 files changed +43
-7
lines changed Original file line number Diff line number Diff line change @@ -43,9 +43,12 @@ class LogicalBinOp {
43
43
LHS = BO->getLHS ();
44
44
RHS = BO->getRHS ();
45
45
} else if (auto *OO = dyn_cast<CXXOperatorCallExpr>(E)) {
46
- Op = OO->getOperator ();
47
- LHS = OO->getArg (0 );
48
- RHS = OO->getArg (1 );
46
+ // If OO is not || or && it might not have exactly 2 arguments.
47
+ if (OO->getNumArgs () == 2 ) {
48
+ Op = OO->getOperator ();
49
+ LHS = OO->getArg (0 );
50
+ RHS = OO->getArg (1 );
51
+ }
49
52
}
50
53
}
51
54
Original file line number Diff line number Diff line change @@ -16722,8 +16722,10 @@ void Sema::PopExpressionEvaluationContext() {
16722
16722
16723
16723
if (!Rec.Lambdas.empty()) {
16724
16724
using ExpressionKind = ExpressionEvaluationContextRecord::ExpressionKind;
16725
- if (Rec.ExprContext == ExpressionKind::EK_TemplateArgument || Rec.isUnevaluated() ||
16726
- (Rec.isConstantEvaluated() && !getLangOpts().CPlusPlus17)) {
16725
+ if (!getLangOpts().CPlusPlus20 &&
16726
+ (Rec.ExprContext == ExpressionKind::EK_TemplateArgument ||
16727
+ Rec.isUnevaluated() ||
16728
+ (Rec.isConstantEvaluated() && !getLangOpts().CPlusPlus17))) {
16727
16729
unsigned D;
16728
16730
if (Rec.isUnevaluated()) {
16729
16731
// C++11 [expr.prim.lambda]p2:
Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ typedef struct // expected-warning {{anonymous non-C-compatible type given name
49
49
: B { // expected-note {{type is not C-compatible due to this base class}}
50
50
} C; // expected-note {{type is given name 'C' for linkage purposes by this typedef declaration}}
51
51
52
- #if __cplusplus > 201703L
52
+ #if __cplusplus > 201703L && __cplusplus < 202002L
53
53
typedef struct { // expected-warning {{anonymous non-C-compatible type given name for linkage purposes by typedef declaration; add a tag name here}}
54
54
static_assert ([]{ return true ; }()); // expected-note {{type is not C-compatible due to this lambda expression}}
55
55
} Lambda1; // expected-note {{type is given name 'Lambda1' for linkage purposes by this typedef declaration}}
Original file line number Diff line number Diff line change
1
+ // RUN: %clang_cc1 -std=c++20 %s -verify
2
+
3
+
4
+ template <auto > struct Nothing {};
5
+ Nothing<[]() { return 0 ; }()> nothing;
6
+
7
+ template <typename > struct NothingT {};
8
+ Nothing<[]() { return 0 ; }> nothingT;
9
+
10
+ template <typename T>
11
+ concept True = [] { return true ; }();
12
+ static_assert (True<int >);
13
+
14
+ static_assert (sizeof ([] { return 0 ; }));
15
+ static_assert (sizeof ([] { return 0 ; }()));
16
+
17
+ void f () noexcept (noexcept ([] { return 0 ; }()));
18
+
19
+ using a = decltype([] { return 0 ; });
20
+ using b = decltype([] { return 0 ; }());
21
+ using c = decltype([]() noexcept (noexcept ([] { return 0 ; }())) { return 0 ; });
22
+ using d = decltype(sizeof ([] { return 0 ; }));
23
+
24
+ template <auto T>
25
+ int unique_test1 ();
26
+ static_assert (&unique_test1<[](){}> != &unique_test1<[](){}>);
27
+
28
+ template <class T >
29
+ auto g (T) -> decltype([]() { T::invalid; } ());
30
+ auto e = g(0 ); // expected-error{{no matching function for call}}
31
+ // expected-note@-2 {{substitution failure}}
Original file line number Diff line number Diff line change @@ -1011,7 +1011,7 @@ <h2 id="cxx20">C++20 implementation status</h2>
1011
1011
< tr >
1012
1012
< td > Lambdas in unevaluated contexts</ td >
1013
1013
< td > < a href ="https://wg21.link/p0315r4 "> P0315R4</ a > </ td >
1014
- < td class ="none " align ="center "> No </ td >
1014
+ < td class ="partial " align ="center "> Clang 13 </ td >
1015
1015
</ tr >
1016
1016
<!-- Jacksonville papers -->
1017
1017
< tr >
You can’t perform that action at this time.
0 commit comments