Fixes link errors with clang and the latest Visual C++ 14.21.27702 headers, which was reported as PR42027. I chose to intentionally make these things linkonce_odr, i.e. discardable, so that we don't emit definitions of these things in every translation unit that includes STL headers. Note that this is *not* what MSVC does: MSVC has not yet implemented C++ DR2387, so they emit fully specialized constexpr variable templates with static / internal linkage. Reviewers: rsmith Differential Revision: https://reviews.llvm.org/D63175 llvm-svn: 363191
12 lines
590 B
C++
12 lines
590 B
C++
// RUN: %clang_cc1 -emit-llvm -triple=x86_64-windows-msvc -fms-compatibility %s -o - | FileCheck %s
|
|
|
|
template <typename> constexpr bool _Is_integer = false;
|
|
template <> constexpr bool _Is_integer<int> = true;
|
|
template <> constexpr bool _Is_integer<char> = false;
|
|
extern "C" const bool *escape = &_Is_integer<int>;
|
|
|
|
// CHECK: @"??$_Is_integer@H@@3_NB" = linkonce_odr dso_local constant i8 1, comdat, align 1
|
|
// Should not emit _Is_integer<char>, since it's not referenced.
|
|
// CHECK-NOT: @"??$_Is_integer@D@@3_NB"
|
|
// CHECK: @escape = dso_local global i8* @"??$_Is_integer@H@@3_NB", align 8
|