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

Does TEST(WriterTest, WriteUIntPtr) use internal::count_digits<4>? #1152

Closed
denchat opened this issue May 9, 2019 · 1 comment
Closed

Does TEST(WriterTest, WriteUIntPtr) use internal::count_digits<4>? #1152

denchat opened this issue May 9, 2019 · 1 comment

Comments

@denchat
Copy link
Contributor

denchat commented May 9, 2019

When I tried to build test in DLL mode, it failed at format-test.exe linking :

LINK: command "C:\PROGRA~2\MIB055~1\2019\BUILDT~1\VC\Tools\MSVC\1420~1.275\bin\Hostx64\x64\link.exe /nologo test\CMakeFiles\format-test.dir\format-test.cc.obj /out:bin\format-test.exe /implib:test\format-test.lib /pdb:bin\format-test.pdb /version:0.0 /machine:x64 /INCREMENTAL:NO /subsystem:console test\test-main.lib test\gmock.lib fmt.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTFILE:bin\format-test.exe.manifest" failed (exit code 1120) with the following output:
format-test.cc.obj : error LNK2019: unresolved external symbol "int __cdecl fmt::v5::internal::count_digits<4,struct fmt::v5::internal::uintptr::uintptr_t>(struct fmt::v5::internal::uintptr::uintptr_t)" (??$count_digits@$03Uuintptr_t@uintptr@internal@v5@fmt@@@internal@v5@fmt@@YAHUuintptr_t@uintptr@012@@Z) referenced in function "private: virtual void __cdecl WriterTest_WriteUIntPtr_Test::TestBody(void)" (?TestBody@WriterTest_WriteUIntPtr_Test@@EEAAXXZ)
bin\format-test.exe : fatal error LNK1120: 1 unresolved externals
[21/47] Building CXX object test\CMakeFiles\chrono-test.dir\chrono-test.cc.obj
ninja: build stopped: subcommand failed.

It's like TEST(WriterTest, WriteUIntPtr) uses internal::count_digits<4>(uintptr_t) which is supposed to stay in implementation test (format-impl-test) only.

However when I look at it :

TEST(WriterTest, WriteUIntPtr) {
  memory_buffer buf;
  fmt::writer writer(buf);
  writer.write_pointer(fmt::internal::bit_cast<fmt::internal::uintptr_t>(
                           reinterpret_cast<void*>(0xface)),
                       FMT_NULL);
  EXPECT_EQ("0xface", to_string(buf));
}

How come it end up refer to internal::count_digits<4>(uintptr_t)?

Should TEST(WriterTest, WriteUIntPtr) be moved to implementation test?

@vitaut
Copy link
Contributor

vitaut commented May 11, 2019

Good catch, thanks! The WriteUIntPtr test does belong to format-impl-test. Fixed in ea2976e.

@vitaut vitaut closed this as completed May 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants