googletest icon indicating copy to clipboard operation
googletest copied to clipboard

TYPED_TEST_SUITE - Must specify at least one argument for '...' parameter of variadic macro

Open jasiux92 opened this issue 5 years ago • 9 comments

When using TYPED_TEST_SUITE below error happens. (using master) Here is log from clang:

path:14:48: error: must specify at least one argument for '...' parameter of variadic macro [-Werror,-Wgnu-zero-variadic-macro-arguments] TYPED_TEST_SUITE(XYZ, MyTypes ); ^ path/gtest/googletest/include/gtest/gtest-typed-test.h:194:9: note: macro 'TYPED_TEST_SUITE' defined here #define TYPED_TEST_SUITE(CaseName, Types, ...)
^ 1 error generated.

Seems like continuation of #2069

jasiux92 avatar Jun 04 '19 10:06 jasiux92

I have to refer to the previous comment https://github.com/google/googletest/issues/2069#issuecomment-457362864

gennadiycivil avatar Jun 04 '19 19:06 gennadiycivil

Ping?

gennadiycivil avatar Jun 10 '19 14:06 gennadiycivil

Hi! I've got exactly the same problem now. In the referred issue you wrote it was eventually fixed. Can we expect another patch for that?

kuzkry avatar Jun 25 '19 11:06 kuzkry

Any update on this? @gennadiycivil

muttleyxd avatar Jul 08 '19 07:07 muttleyxd

When warnings provide no value turning them off is a great solution.

EricWF avatar Aug 10 '19 07:08 EricWF

Basically the same issue was fixed in the past: #2063

Maybe we can you that as base to propose a PR.

marehr avatar Dec 17 '19 13:12 marehr

Hello @marehr, FYI there is strong opposition against introducing new macros in this project. I'd recommend sticking to EricWF's advice.

kuzkry avatar Dec 18 '19 08:12 kuzkry

For reference and other people encountering this warning: see https://github.com/google/googletest/issues/1419#issuecomment-381423292 , that you can silence the warning by adding a comma and an empty macro argument, transforming

TYPED_TEST_SUITE(TestName, TestTypes);

to

TYPED_TEST_SUITE(TestName, TestTypes, );

sethrj avatar Jul 29 '20 15:07 sethrj

Btw. C++20 has solved this issue by changing the requirements on variadic macros and the appropriate patch has been merged to Clang project and released since Clang 14.

The warning wasn't very useful but it was correct. You'll have no issues on C++20 or higher in Clang 14 or higher.

kuzkry avatar Jul 05 '22 12:07 kuzkry