[clang] [clang][ASTImporter] fix variable inline of CXX17 (PR #87314)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 2 05:04:38 PDT 2024
================
@@ -5317,6 +5317,34 @@ TEST_P(ASTImporterOptionSpecificTestBase,
EXPECT_FALSE(ToX);
}
+TEST_P(ASTImporterOptionSpecificTestBase, VarTemplateDeclInlineWithCXX17) {
+ Decl *FromTU = getTuDecl(
+ R"(
+ struct S {
+ template <unsigned> static constexpr bool X = true;
+ };
+ )",
+ Lang_CXX17, "input1.cc");
+ Decl *FromTU2 = getTuDecl(
+ R"(
+ struct S {
+ template <unsigned> static constexpr bool X = true;
+ template <typename T> void get() { X<sizeof(T)>; }
+ };
+ template <typename T> T qvariant_cast(const S &v) { return v.get; }
----------------
NagyDonat wrote:
```suggestion
template <typename U> U qvariant_cast(const S &v) { return v.get; }
```
At first I thought that the template argument `typename T` of this definition is intended to correspond to the same type as the `typename T` in the definition of `get`, while it seems to be a different type, and if this is true, then it'd be better to use a different name. (By the way, is it intentional that you return `v.get` without calling it?)
https://github.com/llvm/llvm-project/pull/87314
More information about the cfe-commits
mailing list