Skip to content

Commit 5d1b63e

Browse files
committed
Fix build on clang 17
We're seeing a clang 17 build failure: ``` ... struct.h:15:30: error: constexpr variable cannot have non-literal type 'const std::string' (aka 'const basic_string<char>') 15 | static constexpr std::string RETVAL_FIELD_NAME = "$retval"; | ^ ... bits/basic_string.h:85:11: note: 'basic_string<char>' is not literal because it is not an aggregate and has no constexpr constructors other than copy or move constructors 85 | class basic_string | ^ 1 error generated. ``` Seems correct - std::string is not very const. Fix by changing it to raw string which should construct temporary std::string& correctly.
1 parent ad2f16b commit 5d1b63e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/struct.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
namespace bpftrace {
1414

15-
static constexpr std::string RETVAL_FIELD_NAME = "$retval";
15+
static constexpr auto RETVAL_FIELD_NAME = "$retval";
1616

1717
struct Bitfield {
1818
Bitfield(size_t byte_offset, size_t bit_width);

0 commit comments

Comments
 (0)