File tree Expand file tree Collapse file tree 4 files changed +3
-30
lines changed Expand file tree Collapse file tree 4 files changed +3
-30
lines changed Original file line number Diff line number Diff line change @@ -743,7 +743,6 @@ Bug Fixes to C++ Support
743
743
in a ``constexpr `` function. (#GH131432)
744
744
- Fixed an incorrect TreeTransform for calls to ``consteval `` functions if a conversion template is present. (#GH137885)
745
745
- Clang now emits a warning when class template argument deduction for alias templates is used in C++17. (#GH133806)
746
- - Fix missed initializer instantiation bug for variable templates. (#GH138122)
747
746
- Fix a crash when checking the template template parameters of a dependent lambda appearing in an alias declaration.
748
747
(#GH136432), (#GH137014), (#GH138018)
749
748
- Fixed an assertion when trying to constant-fold various builtins when the argument
Original file line number Diff line number Diff line change @@ -6032,11 +6032,11 @@ void Sema::BuildVariableInstantiation(
6032
6032
Context.setStaticLocalNumber (NewVar, Context.getStaticLocalNumber (OldVar));
6033
6033
6034
6034
// Figure out whether to eagerly instantiate the initializer.
6035
- if (NewVar->getType ()->isUndeducedType ()) {
6035
+ if (InstantiatingVarTemplate || InstantiatingVarTemplatePartialSpec) {
6036
+ // We're producing a template. Don't instantiate the initializer yet.
6037
+ } else if (NewVar->getType ()->isUndeducedType ()) {
6036
6038
// We need the type to complete the declaration of the variable.
6037
6039
InstantiateVariableInitializer (NewVar, OldVar, TemplateArgs);
6038
- } else if (InstantiatingVarTemplate || InstantiatingVarTemplatePartialSpec) {
6039
- // We're producing a template. Don't instantiate the initializer yet.
6040
6040
} else if (InstantiatingSpecFromTemplate ||
6041
6041
(OldVar->isInline () && OldVar->isThisDeclarationADefinition () &&
6042
6042
!NewVar->isThisDeclarationADefinition ())) {
Original file line number Diff line number Diff line change 1
1
// RUN: %clang_cc1 -std=c++1z %s -emit-llvm -o - -triple x86_64-linux-gnu | FileCheck %s
2
2
3
- template <typename T> struct InlineAuto {
4
- template <typename G> inline static auto var = 5 ;
5
- };
6
- int inlineauto = InlineAuto<int >::var<int >;
7
- // CHECK: @_ZN10InlineAutoIiE3varIiEE = {{.*}}i32 5{{.*}}comdat
8
- //
9
- template <typename > struct PartialInlineAuto {
10
- template <typename , typename > inline static auto var = 6 ;
11
- template <typename T> inline static auto var<int , T> = 7 ;
12
- };
13
-
14
- int partialinlineauto = PartialInlineAuto<int >::var<int , int >;
15
- // CHECK: @_ZN17PartialInlineAutoIiE3varIiiEE = {{.*}}i32 7{{.*}}comdat
16
-
17
3
struct Q {
18
4
// CHECK: @_ZN1Q1kE = linkonce_odr constant i32 5, comdat
19
5
static constexpr int k = 5 ;
Original file line number Diff line number Diff line change @@ -27,15 +27,3 @@ template <typename T> constexpr int A<T>::n = sizeof(A) + sizeof(T);
27
27
template <typename T> inline constexpr int A<T>::m = sizeof (A) + sizeof (T);
28
28
static_assert (A<int >().f() == 5 );
29
29
static_assert (A<int >().g() == 5 );
30
-
31
- template <typename T> struct InlineAuto {
32
- template <typename G> inline static auto var = 5 ;
33
- };
34
-
35
- template <typename > struct PartialInlineAuto {
36
- template <typename , typename > inline static auto var = 6 ;
37
- template <typename T> inline static auto var<int , T> = 7 ;
38
- };
39
-
40
- int inlineauto = InlineAuto<int >::var<int >;
41
- int partialinlineauto = PartialInlineAuto<int >::var<int , int >;
You can’t perform that action at this time.
0 commit comments