Skip to content

Commit 8432444

Browse files
committed
add test
1 parent b9644e7 commit 8432444

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

test/testio.cpp

+11
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ class TestIO : public TestFixture {
7878
TEST_CASE(testParameterPack); // #11289
7979

8080
TEST_CASE(testDefaultSignInt); // #13363
81+
TEST_CASE(testPrintfWithGeneric); // #13592
8182
}
8283

8384
struct CheckOptions
@@ -4952,6 +4953,16 @@ class TestIO : public TestFixture {
49524953
check(code, dinit(CheckOptions, $.defaultSign = 'u'));
49534954
ASSERT_EQUALS("", errout_str());
49544955
}
4956+
4957+
void testPrintfWithGeneric() { // #13592
4958+
const char code[] =
4959+
"void f(void) {\n"
4960+
" float x = 27.0f;\n"
4961+
" printf(\"%s\\n\", _Generic(x, double: cbrt, float: cbrtf)(x));\n"
4962+
"}\n";
4963+
check(code);
4964+
ASSERT_EQUALS("", errout_str());
4965+
}
49554966
};
49564967

49574968
REGISTER_TEST(TestIO)

0 commit comments

Comments
 (0)