Skip to content

Commit 4de73d1

Browse files
committed
Merge commit 'be48c0df7741' from llvm.org/main into next
2 parents 95f423b + 47144fc commit 4de73d1

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

clang/lib/CodeGen/CGBlocks.h

-1
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,6 @@ class BlockByrefInfo {
146146
enum class BlockCaptureEntityKind {
147147
None,
148148
CXXRecord, // Copy or destroy
149-
AddressDiscriminatedPointerAuth,
150149
ARCWeak,
151150
ARCStrong,
152151
NonTrivialCStruct,

clang/test/SemaCXX/bug149071318.cpp

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// RUN: %clang_cc1 -std=c++20 -Wno-all -Wunsafe-buffer-usage \
2+
// RUN: -verify %s
3+
4+
// This example uncovered a bug in UnsafeBufferUsage.cpp, where the
5+
// code assumed that a CXXMethodDecl always have an identifier.
6+
7+
int printf( const char* format, char *); // <-- Fake decl of `printf`; to reproduce the bug, this example needs an implicit cast within a printf call.
8+
9+
namespace std { // fake std namespace; to reproduce the bug, a CXXConversionDecl needs to be in std namespace.
10+
class X {
11+
char * p;
12+
public:
13+
operator char*() {return p;}
14+
};
15+
16+
class Y {
17+
public:
18+
X x;
19+
};
20+
21+
}
22+
23+
void test(std::Y &y) {
24+
// Here `y.x` involves an implicit cast and calls the overloaded cast operator, which has no identifier:
25+
printf("%s", y.x); // expected-warning{{function 'printf' is unsafe}} expected-note{{}}
26+
}

0 commit comments

Comments
 (0)