diff --git a/src/translate_c.zig b/src/translate_c.zig index 7469c6e99690..e57a1952af76 100644 --- a/src/translate_c.zig +++ b/src/translate_c.zig @@ -1797,6 +1797,10 @@ fn exprIsStringLiteral(expr: *const clang.Expr) bool { const op_expr = @ptrCast(*const clang.UnaryOperator, expr).getSubExpr(); return exprIsStringLiteral(op_expr); }, + .ParenExprClass => { + const op_expr = @ptrCast(*const clang.ParenExpr, expr).getSubExpr(); + return exprIsStringLiteral(op_expr); + }, else => return false, } } diff --git a/test/run_translated_c.zig b/test/run_translated_c.zig index eb0b7db50a8c..f51beb18bf2a 100644 --- a/test/run_translated_c.zig +++ b/test/run_translated_c.zig @@ -3,6 +3,13 @@ const tests = @import("tests.zig"); const nl = std.cstr.line_sep; pub fn addCases(cases: *tests.RunTranslatedCContext) void { + cases.add("parenthesized string literal", + \\void foo(const char *s) {} + \\int main(void) { + \\ foo(("bar")); + \\} + , ""); + cases.add("variable shadowing type type", \\#include \\int main() {