From 75f862bf574743e9c68e2b694142bdaf7cfcc44d Mon Sep 17 00:00:00 2001 From: Sean LK Date: Sat, 25 Jun 2016 05:16:22 +0000 Subject: [PATCH] Fix building with clang in header-only mode Building under a recent clang compiler causes the use of an extern template for the BasicData struct. However, the only instantiation of that structure in format.cc is only done if FMT_HEADER_ONLY is not defined. This causes the build to fail in C++11 or C++14 mode. Therefore, only declare the BasicData template as extern if FMT_HEADER_ONLY is not defined. --- fmt/format.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fmt/format.h b/fmt/format.h index 2c0b36ee..bcae5a21 100644 --- a/fmt/format.h +++ b/fmt/format.h @@ -841,7 +841,7 @@ struct FMT_API BasicData { # define FMT_USE_EXTERN_TEMPLATES (__clang__ && FMT_USE_VARIADIC_TEMPLATES) #endif -#if FMT_USE_EXTERN_TEMPLATES +#if FMT_USE_EXTERN_TEMPLATES && !defined(FMT_HEADER_ONLY) extern template struct BasicData; #endif