Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use trailing return types inside macros #3439

Closed
purpleKarrot opened this issue Jun 10, 2021 · 1 comment
Closed

Use trailing return types inside macros #3439

purpleKarrot opened this issue Jun 10, 2021 · 1 comment
Labels

Comments

@purpleKarrot
Copy link

While #2442 is about clang-tidy warnings in googletest's own header files (which can be suppressed by simply not checking them), there are also clang-tidy warnings reported in client source code. Example:

TEST(Test, Case) {}

This causes:

test.cpp:7:1: warning: use a trailing return type for this function [modernize-use-trailing-return-type]
TEST(Test, Case) {
^
include/gtest/gtest.h:2353:42: note: expanded from macro 'TEST'
#define TEST(test_suite_name, test_name) GTEST_TEST(test_suite_name, test_name)
                                         ^
include/gtest/gtest.h:2347:3: note: expanded from macro 'GTEST_TEST'
  GTEST_TEST_(test_suite_name, test_name, ::testing::Test, \
  ^
include/gtest/internal/gtest-internal.h:1537:5: note: expanded from macro 'GTEST_TEST_'
    GTEST_DISALLOW_COPY_AND_ASSIGN_(GTEST_TEST_CLASS_NAME_(test_suite_name,   \
    ^
include/gtest/internal/gtest-port.h:699:9: note: expanded from macro 'GTEST_DISALLOW_COPY_AND_ASSIGN_'
  type& operator=(type const&) = delete
        ^

This can easily be fixed by using trailing return types for all assignment operators inside macros (there are three of them).

@derekmauro
Copy link
Member

This is a style choice rather than a bug, and we prefer not to change the style.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants