We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b9644e7 commit 8432444Copy full SHA for 8432444
test/testio.cpp
@@ -78,6 +78,7 @@ class TestIO : public TestFixture {
78
TEST_CASE(testParameterPack); // #11289
79
80
TEST_CASE(testDefaultSignInt); // #13363
81
+ TEST_CASE(testPrintfWithGeneric); // #13592
82
}
83
84
struct CheckOptions
@@ -4952,6 +4953,16 @@ class TestIO : public TestFixture {
4952
4953
check(code, dinit(CheckOptions, $.defaultSign = 'u'));
4954
ASSERT_EQUALS("", errout_str());
4955
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
+ }
4966
};
4967
4968
REGISTER_TEST(TestIO)
0 commit comments