[PATCH] D128119: [clang] Enforce instantiation of constexpr template functions during non-constexpr evaluation

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 8 07:42:32 PDT 2022


aaron.ballman added a comment.

Can you also add a release note for the fix?



================
Comment at: clang/test/SemaCXX/constexpr-late-instantiation.cpp:2
+// Make sure foo is instantiated and we don't get a link error
+// RUN: not %clang_cc1 -S -emit-llvm %s -fsyntax-only 2>&1 | FileCheck %s
+
----------------



================
Comment at: clang/test/SemaCXX/constexpr-late-instantiation.cpp:9
+  int k = foo<int>(5);           // Ok
+  constexpr int j = foo<int>(5); // CHECK: error: constexpr variable 'j' must be initialized by a constant expression
+}
----------------



CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D128119/new/

https://reviews.llvm.org/D128119



More information about the cfe-commits mailing list