[PATCH] D126172: [clang] Fix comparison of TemplateArgument when they are of template kind

2022-09-02 Thread Robert Esclapez via Phabricator via cfe-commits
roberteg16 added a comment.

In D126172#3754221 , @mizvekov wrote:

> Hello, @roberteg16, are you still interested in working on this patch?
>
> I might need a fix for this myself, and also it happened recently that 
> someone else attempted a fix for the same bug.
>
> If you are not abandoning it, please let us know!

Hey @mizvekov! Sorry for the late response.

Yes, I am still interested and I am working on this. I'll let you know ASAP if 
I find something that resembles a valid fix.

I would be very grateful if you could give me some tips for debuging better 
clang or if you could point me towards documents, links, whatever that could 
give me nice information about how to reason about the code of the parser/sema 
of clang.

If you are in a hurry and need to fix it yourself and it happens that you 
finish the path first, please @ me so I can get to see how an error like this 
would be fixed, thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D126172

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D126172: [clang] Fix comparison of TemplateArgument when they are of template kind

2022-07-02 Thread Robert Esclapez via Phabricator via cfe-commits
roberteg16 added a comment.

Hi again @mizvekov, I've been spending a bit of time on resuming this issue.

When applying (after reverting the changes) the first change related to the 
`Template` case of profiling the as-written one name this resulted in the 
following test failing:

Changes:

  -ID.AddPointer(Context.getCanonicalTemplateName(Template)
  .getAsVoidPointer());
  +ID.AddPointer(Template.getAsVoidPointer());


Test failing:

  Clang :: 
CXX/basic/basic.lookup/basic.lookup.argdep/p2-associated-namespaces-classes.cpp
  Clang :: CXX/temp/temp.decls/temp.variadic/multi-level-substitution.cpp
  Clang :: CodeGenCXX/mangle-variadic-templates.cpp
  Clang :: CodeGenCXX/mangle.cpp

The main reason of the failure is that now clang outputs errors. I'll only copy 
the CodeGenCXX/mangle.cpp output:

  /home/robert/Documents/llvm-project/clang/test/CodeGenCXX/mangle.cpp:516:17: 
error: explicit instantiation of 'foo' does not refer to a function template, 
variable template, member function, member class, or static data member
template void foo(const A &a);
  ^
  /home/robert/Documents/llvm-project/clang/test/CodeGenCXX/mangle.cpp:513:43: 
note: candidate template ignored: failed template argument deduction
template  class T> void foo(const A &a) {}
^
  /home/robert/Documents/llvm-project/clang/test/CodeGenCXX/mangle.cpp:1146:10: 
warning: decomposition declarations are a C++17 extension [-Wc++17-extensions]
  auto [e] = g;
   ^~~
  /home/robert/Documents/llvm-project/clang/test/CodeGenCXX/mangle.cpp:1153:8: 
warning: decomposition declarations are a C++17 extension [-Wc++17-extensions]
auto [a,b] = X{1,2};

I've been looking around trying to figure out what's the issue but I am feeling 
that I lack the required knowledge to diagnose properly the problem.

One question I want to ask is: On `StmtProfiler::VisitTemplateArgument` it 
states on a comment:

> // Mostly repetitive with TemplateArgument::Profile!

but as far as I could see it really does not mimic the behavior in some cases. 
Is this at purpose?

Thanks for your time.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D126172

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D126172: [clang] Fix comparison of TemplateArgument when they are of template kind

2022-05-22 Thread Robert Esclapez via Phabricator via cfe-commits
roberteg16 created this revision.
roberteg16 added reviewers: Richard, smith.
Herald added a project: All.
roberteg16 requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This diff path takes care of comparing Template{Expansion} by template decl
instead of by comparing the ptr attr Name and the number of expansions.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D126172

Files:
  clang/lib/AST/TemplateBase.cpp
  clang/test/CXX/dcl/dcl.fct/p17.cpp


Index: clang/test/CXX/dcl/dcl.fct/p17.cpp
===
--- clang/test/CXX/dcl/dcl.fct/p17.cpp
+++ clang/test/CXX/dcl/dcl.fct/p17.cpp
@@ -257,4 +257,21 @@
   static_assert(is_same_v);
   // expected-error@-1{{no matching}}
   static_assert(is_same_v);
+
+  template 
+  struct S3 {};
+  // expected-note@-1 {{'S3' declared here}}
+  // expected-note@-2 {{template is declared here}}
+  void f23(C2<::S3> auto);
+  // expected-error@-1 {{no template named 'S3' in the global namespace; did 
you mean simply 'S3'?}}
+  // expected-error@-2 {{use of class template '::S3' requires template 
arguments}}
+}
+
+template 
+struct S4 {};
+// expected-note@-1 {{template is declared here}}
+
+namespace constrained {
+  void f24(C2<::S4> auto);
+  // expected-error@-1 {{use of class template '::S4' requires template 
arguments}}
 }
Index: clang/lib/AST/TemplateBase.cpp
===
--- clang/lib/AST/TemplateBase.cpp
+++ clang/lib/AST/TemplateBase.cpp
@@ -370,8 +370,8 @@
 
   case Template:
   case TemplateExpansion:
-return TemplateArg.Name == Other.TemplateArg.Name &&
-   TemplateArg.NumExpansions == Other.TemplateArg.NumExpansions;
+return getAsTemplateOrTemplatePattern().getAsTemplateDecl() ==
+   Other.getAsTemplateOrTemplatePattern().getAsTemplateDecl();
 
   case Declaration:
 return getAsDecl() == Other.getAsDecl();


Index: clang/test/CXX/dcl/dcl.fct/p17.cpp
===
--- clang/test/CXX/dcl/dcl.fct/p17.cpp
+++ clang/test/CXX/dcl/dcl.fct/p17.cpp
@@ -257,4 +257,21 @@
   static_assert(is_same_v);
   // expected-error@-1{{no matching}}
   static_assert(is_same_v);
+
+  template 
+  struct S3 {};
+  // expected-note@-1 {{'S3' declared here}}
+  // expected-note@-2 {{template is declared here}}
+  void f23(C2<::S3> auto);
+  // expected-error@-1 {{no template named 'S3' in the global namespace; did you mean simply 'S3'?}}
+  // expected-error@-2 {{use of class template '::S3' requires template arguments}}
+}
+
+template 
+struct S4 {};
+// expected-note@-1 {{template is declared here}}
+
+namespace constrained {
+  void f24(C2<::S4> auto);
+  // expected-error@-1 {{use of class template '::S4' requires template arguments}}
 }
Index: clang/lib/AST/TemplateBase.cpp
===
--- clang/lib/AST/TemplateBase.cpp
+++ clang/lib/AST/TemplateBase.cpp
@@ -370,8 +370,8 @@
 
   case Template:
   case TemplateExpansion:
-return TemplateArg.Name == Other.TemplateArg.Name &&
-   TemplateArg.NumExpansions == Other.TemplateArg.NumExpansions;
+return getAsTemplateOrTemplatePattern().getAsTemplateDecl() ==
+   Other.getAsTemplateOrTemplatePattern().getAsTemplateDecl();
 
   case Declaration:
 return getAsDecl() == Other.getAsDecl();
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D126172: [clang] Fix comparison of TemplateArgument when they are of template kind

2022-05-22 Thread Robert Esclapez via Phabricator via cfe-commits
roberteg16 updated this revision to Diff 431264.
roberteg16 edited the summary of this revision.
roberteg16 added a comment.

Make clang-format not complain


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D126172

Files:
  clang/lib/AST/TemplateBase.cpp
  clang/test/CXX/dcl/dcl.fct/p17.cpp


Index: clang/test/CXX/dcl/dcl.fct/p17.cpp
===
--- clang/test/CXX/dcl/dcl.fct/p17.cpp
+++ clang/test/CXX/dcl/dcl.fct/p17.cpp
@@ -257,4 +257,23 @@
   static_assert(is_same_v);
   // expected-error@-1{{no matching}}
   static_assert(is_same_v);
-}
+
+  // clang-format off
+  template  struct S3 {};
+  // expected-note@-1 {{'S3' declared here}}
+  // expected-note@-2 {{template is declared here}}
+  void f23(C2<::S3> auto);
+  // expected-error@-1 {{no template named 'S3' in the global namespace; did 
you mean simply 'S3'?}}
+  // expected-error@-2 {{use of class template '::S3' requires template 
arguments}}
+  // clang-format on
+} // namespace constrained
+
+template  struct S4 {};
+// expected-note@-1 {{template is declared here}}
+
+namespace constrained {
+// clang-format off
+void f24(C2<::S4> auto);
+// expected-error@-1 {{use of class template '::S4' requires template 
arguments}}
+// clang-format on
+} // namespace constrained
Index: clang/lib/AST/TemplateBase.cpp
===
--- clang/lib/AST/TemplateBase.cpp
+++ clang/lib/AST/TemplateBase.cpp
@@ -370,8 +370,8 @@
 
   case Template:
   case TemplateExpansion:
-return TemplateArg.Name == Other.TemplateArg.Name &&
-   TemplateArg.NumExpansions == Other.TemplateArg.NumExpansions;
+return getAsTemplateOrTemplatePattern().getAsTemplateDecl() ==
+   Other.getAsTemplateOrTemplatePattern().getAsTemplateDecl();
 
   case Declaration:
 return getAsDecl() == Other.getAsDecl();


Index: clang/test/CXX/dcl/dcl.fct/p17.cpp
===
--- clang/test/CXX/dcl/dcl.fct/p17.cpp
+++ clang/test/CXX/dcl/dcl.fct/p17.cpp
@@ -257,4 +257,23 @@
   static_assert(is_same_v);
   // expected-error@-1{{no matching}}
   static_assert(is_same_v);
-}
+
+  // clang-format off
+  template  struct S3 {};
+  // expected-note@-1 {{'S3' declared here}}
+  // expected-note@-2 {{template is declared here}}
+  void f23(C2<::S3> auto);
+  // expected-error@-1 {{no template named 'S3' in the global namespace; did you mean simply 'S3'?}}
+  // expected-error@-2 {{use of class template '::S3' requires template arguments}}
+  // clang-format on
+} // namespace constrained
+
+template  struct S4 {};
+// expected-note@-1 {{template is declared here}}
+
+namespace constrained {
+// clang-format off
+void f24(C2<::S4> auto);
+// expected-error@-1 {{use of class template '::S4' requires template arguments}}
+// clang-format on
+} // namespace constrained
Index: clang/lib/AST/TemplateBase.cpp
===
--- clang/lib/AST/TemplateBase.cpp
+++ clang/lib/AST/TemplateBase.cpp
@@ -370,8 +370,8 @@
 
   case Template:
   case TemplateExpansion:
-return TemplateArg.Name == Other.TemplateArg.Name &&
-   TemplateArg.NumExpansions == Other.TemplateArg.NumExpansions;
+return getAsTemplateOrTemplatePattern().getAsTemplateDecl() ==
+   Other.getAsTemplateOrTemplatePattern().getAsTemplateDecl();
 
   case Declaration:
 return getAsDecl() == Other.getAsDecl();
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D126172: [clang] Fix comparison of TemplateArgument when they are of template kind

2022-05-23 Thread Robert Esclapez via Phabricator via cfe-commits
roberteg16 updated this revision to Diff 431356.
roberteg16 added a comment.

Stricten comparison


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D126172

Files:
  clang/lib/AST/TemplateBase.cpp
  clang/test/CXX/dcl/dcl.fct/p17.cpp


Index: clang/test/CXX/dcl/dcl.fct/p17.cpp
===
--- clang/test/CXX/dcl/dcl.fct/p17.cpp
+++ clang/test/CXX/dcl/dcl.fct/p17.cpp
@@ -257,4 +257,23 @@
   static_assert(is_same_v);
   // expected-error@-1{{no matching}}
   static_assert(is_same_v);
-}
+
+  // clang-format off
+  template  struct S3 {};
+  // expected-note@-1 {{'S3' declared here}}
+  // expected-note@-2 {{template is declared here}}
+  void f23(C2<::S3> auto);
+  // expected-error@-1 {{no template named 'S3' in the global namespace; did 
you mean simply 'S3'?}}
+  // expected-error@-2 {{use of class template '::S3' requires template 
arguments}}
+  // clang-format on
+} // namespace constrained
+
+template  struct S4 {};
+// expected-note@-1 {{template is declared here}}
+
+namespace constrained {
+// clang-format off
+void f24(C2<::S4> auto);
+// expected-error@-1 {{use of class template '::S4' requires template 
arguments}}
+// clang-format on
+} // namespace constrained
Index: clang/lib/AST/TemplateBase.cpp
===
--- clang/lib/AST/TemplateBase.cpp
+++ clang/lib/AST/TemplateBase.cpp
@@ -370,7 +370,8 @@
 
   case Template:
   case TemplateExpansion:
-return TemplateArg.Name == Other.TemplateArg.Name &&
+return getAsTemplateOrTemplatePattern().getAsTemplateDecl() ==
+   Other.getAsTemplateOrTemplatePattern().getAsTemplateDecl() &&
TemplateArg.NumExpansions == Other.TemplateArg.NumExpansions;
 
   case Declaration:


Index: clang/test/CXX/dcl/dcl.fct/p17.cpp
===
--- clang/test/CXX/dcl/dcl.fct/p17.cpp
+++ clang/test/CXX/dcl/dcl.fct/p17.cpp
@@ -257,4 +257,23 @@
   static_assert(is_same_v);
   // expected-error@-1{{no matching}}
   static_assert(is_same_v);
-}
+
+  // clang-format off
+  template  struct S3 {};
+  // expected-note@-1 {{'S3' declared here}}
+  // expected-note@-2 {{template is declared here}}
+  void f23(C2<::S3> auto);
+  // expected-error@-1 {{no template named 'S3' in the global namespace; did you mean simply 'S3'?}}
+  // expected-error@-2 {{use of class template '::S3' requires template arguments}}
+  // clang-format on
+} // namespace constrained
+
+template  struct S4 {};
+// expected-note@-1 {{template is declared here}}
+
+namespace constrained {
+// clang-format off
+void f24(C2<::S4> auto);
+// expected-error@-1 {{use of class template '::S4' requires template arguments}}
+// clang-format on
+} // namespace constrained
Index: clang/lib/AST/TemplateBase.cpp
===
--- clang/lib/AST/TemplateBase.cpp
+++ clang/lib/AST/TemplateBase.cpp
@@ -370,7 +370,8 @@
 
   case Template:
   case TemplateExpansion:
-return TemplateArg.Name == Other.TemplateArg.Name &&
+return getAsTemplateOrTemplatePattern().getAsTemplateDecl() ==
+   Other.getAsTemplateOrTemplatePattern().getAsTemplateDecl() &&
TemplateArg.NumExpansions == Other.TemplateArg.NumExpansions;
 
   case Declaration:
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D126172: [clang] Fix comparison of TemplateArgument when they are of template kind

2022-05-23 Thread Robert Esclapez via Phabricator via cfe-commits
roberteg16 updated this revision to Diff 431389.
roberteg16 added a comment.

Try fix clang-format


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D126172

Files:
  clang/lib/AST/TemplateBase.cpp
  clang/test/CXX/dcl/dcl.fct/p17.cpp


Index: clang/test/CXX/dcl/dcl.fct/p17.cpp
===
--- clang/test/CXX/dcl/dcl.fct/p17.cpp
+++ clang/test/CXX/dcl/dcl.fct/p17.cpp
@@ -257,4 +257,23 @@
   static_assert(is_same_v);
   // expected-error@-1{{no matching}}
   static_assert(is_same_v);
-}
+
+// clang-format off
+  template  struct S3 {};
+  // expected-note@-1 {{'S3' declared here}}
+  // expected-note@-2 {{template is declared here}}
+  void f23(C2<::S3> auto);
+  // expected-error@-1 {{no template named 'S3' in the global namespace; did 
you mean simply 'S3'?}}
+  // expected-error@-2 {{use of class template '::S3' requires template 
arguments}}
+// clang-format on
+} // namespace constrained
+
+template  struct S4 {};
+// expected-note@-1 {{template is declared here}}
+
+namespace constrained {
+// clang-format off
+void f24(C2<::S4> auto);
+// expected-error@-1 {{use of class template '::S4' requires template 
arguments}}
+// clang-format on
+} // namespace constrained
Index: clang/lib/AST/TemplateBase.cpp
===
--- clang/lib/AST/TemplateBase.cpp
+++ clang/lib/AST/TemplateBase.cpp
@@ -370,7 +370,8 @@
 
   case Template:
   case TemplateExpansion:
-return TemplateArg.Name == Other.TemplateArg.Name &&
+return getAsTemplateOrTemplatePattern().getAsTemplateDecl() ==
+   Other.getAsTemplateOrTemplatePattern().getAsTemplateDecl() &&
TemplateArg.NumExpansions == Other.TemplateArg.NumExpansions;
 
   case Declaration:


Index: clang/test/CXX/dcl/dcl.fct/p17.cpp
===
--- clang/test/CXX/dcl/dcl.fct/p17.cpp
+++ clang/test/CXX/dcl/dcl.fct/p17.cpp
@@ -257,4 +257,23 @@
   static_assert(is_same_v);
   // expected-error@-1{{no matching}}
   static_assert(is_same_v);
-}
+
+// clang-format off
+  template  struct S3 {};
+  // expected-note@-1 {{'S3' declared here}}
+  // expected-note@-2 {{template is declared here}}
+  void f23(C2<::S3> auto);
+  // expected-error@-1 {{no template named 'S3' in the global namespace; did you mean simply 'S3'?}}
+  // expected-error@-2 {{use of class template '::S3' requires template arguments}}
+// clang-format on
+} // namespace constrained
+
+template  struct S4 {};
+// expected-note@-1 {{template is declared here}}
+
+namespace constrained {
+// clang-format off
+void f24(C2<::S4> auto);
+// expected-error@-1 {{use of class template '::S4' requires template arguments}}
+// clang-format on
+} // namespace constrained
Index: clang/lib/AST/TemplateBase.cpp
===
--- clang/lib/AST/TemplateBase.cpp
+++ clang/lib/AST/TemplateBase.cpp
@@ -370,7 +370,8 @@
 
   case Template:
   case TemplateExpansion:
-return TemplateArg.Name == Other.TemplateArg.Name &&
+return getAsTemplateOrTemplatePattern().getAsTemplateDecl() ==
+   Other.getAsTemplateOrTemplatePattern().getAsTemplateDecl() &&
TemplateArg.NumExpansions == Other.TemplateArg.NumExpansions;
 
   case Declaration:
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D126172: [clang] Fix comparison of TemplateArgument when they are of template kind

2022-05-23 Thread Robert Esclapez via Phabricator via cfe-commits
roberteg16 updated this revision to Diff 431416.
roberteg16 added a comment.

Fix clang-format


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D126172

Files:
  clang/lib/AST/TemplateBase.cpp
  clang/test/CXX/dcl/dcl.fct/p17.cpp


Index: clang/test/CXX/dcl/dcl.fct/p17.cpp
===
--- clang/test/CXX/dcl/dcl.fct/p17.cpp
+++ clang/test/CXX/dcl/dcl.fct/p17.cpp
@@ -257,4 +257,23 @@
   static_assert(is_same_v);
   // expected-error@-1{{no matching}}
   static_assert(is_same_v);
-}
+
+  template  struct S3 {};
+  // expected-note@-1 {{'S3' declared here}}
+  // expected-note@-2 {{template is declared here}}
+  void f23(C2<::S3> auto);
+  // clang-format off
+  // expected-error@-1 {{no template named 'S3' in the global namespace; did 
you mean simply 'S3'?}}
+  // expected-error@-2 {{use of class template '::S3' requires template 
arguments}}
+  // clang-format on
+  } // namespace constrained
+
+  template  struct S4 {};
+  // expected-note@-1 {{template is declared here}}
+
+  namespace constrained {
+  void f24(C2<::S4> auto);
+  // clang-format off
+  // expected-error@-1 {{use of class template '::S4' requires template 
arguments}}
+  // clang-format on
+  } // namespace constrained
Index: clang/lib/AST/TemplateBase.cpp
===
--- clang/lib/AST/TemplateBase.cpp
+++ clang/lib/AST/TemplateBase.cpp
@@ -370,7 +370,8 @@
 
   case Template:
   case TemplateExpansion:
-return TemplateArg.Name == Other.TemplateArg.Name &&
+return getAsTemplateOrTemplatePattern().getAsTemplateDecl() ==
+   Other.getAsTemplateOrTemplatePattern().getAsTemplateDecl() &&
TemplateArg.NumExpansions == Other.TemplateArg.NumExpansions;
 
   case Declaration:


Index: clang/test/CXX/dcl/dcl.fct/p17.cpp
===
--- clang/test/CXX/dcl/dcl.fct/p17.cpp
+++ clang/test/CXX/dcl/dcl.fct/p17.cpp
@@ -257,4 +257,23 @@
   static_assert(is_same_v);
   // expected-error@-1{{no matching}}
   static_assert(is_same_v);
-}
+
+  template  struct S3 {};
+  // expected-note@-1 {{'S3' declared here}}
+  // expected-note@-2 {{template is declared here}}
+  void f23(C2<::S3> auto);
+  // clang-format off
+  // expected-error@-1 {{no template named 'S3' in the global namespace; did you mean simply 'S3'?}}
+  // expected-error@-2 {{use of class template '::S3' requires template arguments}}
+  // clang-format on
+  } // namespace constrained
+
+  template  struct S4 {};
+  // expected-note@-1 {{template is declared here}}
+
+  namespace constrained {
+  void f24(C2<::S4> auto);
+  // clang-format off
+  // expected-error@-1 {{use of class template '::S4' requires template arguments}}
+  // clang-format on
+  } // namespace constrained
Index: clang/lib/AST/TemplateBase.cpp
===
--- clang/lib/AST/TemplateBase.cpp
+++ clang/lib/AST/TemplateBase.cpp
@@ -370,7 +370,8 @@
 
   case Template:
   case TemplateExpansion:
-return TemplateArg.Name == Other.TemplateArg.Name &&
+return getAsTemplateOrTemplatePattern().getAsTemplateDecl() ==
+   Other.getAsTemplateOrTemplatePattern().getAsTemplateDecl() &&
TemplateArg.NumExpansions == Other.TemplateArg.NumExpansions;
 
   case Declaration:
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D126172: [clang] Fix comparison of TemplateArgument when they are of template kind

2022-05-23 Thread Robert Esclapez via Phabricator via cfe-commits
roberteg16 updated this revision to Diff 431451.
roberteg16 added a comment.

Fix wrongly moved clang-format disabling comment when trying to fix clang-format


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D126172

Files:
  clang/lib/AST/TemplateBase.cpp
  clang/test/CXX/dcl/dcl.fct/p17.cpp


Index: clang/test/CXX/dcl/dcl.fct/p17.cpp
===
--- clang/test/CXX/dcl/dcl.fct/p17.cpp
+++ clang/test/CXX/dcl/dcl.fct/p17.cpp
@@ -257,4 +257,23 @@
   static_assert(is_same_v);
   // expected-error@-1{{no matching}}
   static_assert(is_same_v);
-}
+
+  template  struct S3 {};
+  // expected-note@-1 {{'S3' declared here}}
+  // expected-note@-2 {{template is declared here}}
+  // clang-format off
+  void f23(C2<::S3> auto);
+  // expected-error@-1 {{no template named 'S3' in the global namespace; did 
you mean simply 'S3'?}}
+  // expected-error@-2 {{use of class template '::S3' requires template 
arguments}}
+  // clang-format on
+  } // namespace constrained
+
+  template  struct S4 {};
+  // expected-note@-1 {{template is declared here}}
+
+  namespace constrained {
+  // clang-format off
+  void f24(C2<::S4> auto);
+  // expected-error@-1 {{use of class template '::S4' requires template 
arguments}}
+  // clang-format on
+  } // namespace constrained
Index: clang/lib/AST/TemplateBase.cpp
===
--- clang/lib/AST/TemplateBase.cpp
+++ clang/lib/AST/TemplateBase.cpp
@@ -370,7 +370,8 @@
 
   case Template:
   case TemplateExpansion:
-return TemplateArg.Name == Other.TemplateArg.Name &&
+return getAsTemplateOrTemplatePattern().getAsTemplateDecl() ==
+   Other.getAsTemplateOrTemplatePattern().getAsTemplateDecl() &&
TemplateArg.NumExpansions == Other.TemplateArg.NumExpansions;
 
   case Declaration:


Index: clang/test/CXX/dcl/dcl.fct/p17.cpp
===
--- clang/test/CXX/dcl/dcl.fct/p17.cpp
+++ clang/test/CXX/dcl/dcl.fct/p17.cpp
@@ -257,4 +257,23 @@
   static_assert(is_same_v);
   // expected-error@-1{{no matching}}
   static_assert(is_same_v);
-}
+
+  template  struct S3 {};
+  // expected-note@-1 {{'S3' declared here}}
+  // expected-note@-2 {{template is declared here}}
+  // clang-format off
+  void f23(C2<::S3> auto);
+  // expected-error@-1 {{no template named 'S3' in the global namespace; did you mean simply 'S3'?}}
+  // expected-error@-2 {{use of class template '::S3' requires template arguments}}
+  // clang-format on
+  } // namespace constrained
+
+  template  struct S4 {};
+  // expected-note@-1 {{template is declared here}}
+
+  namespace constrained {
+  // clang-format off
+  void f24(C2<::S4> auto);
+  // expected-error@-1 {{use of class template '::S4' requires template arguments}}
+  // clang-format on
+  } // namespace constrained
Index: clang/lib/AST/TemplateBase.cpp
===
--- clang/lib/AST/TemplateBase.cpp
+++ clang/lib/AST/TemplateBase.cpp
@@ -370,7 +370,8 @@
 
   case Template:
   case TemplateExpansion:
-return TemplateArg.Name == Other.TemplateArg.Name &&
+return getAsTemplateOrTemplatePattern().getAsTemplateDecl() ==
+   Other.getAsTemplateOrTemplatePattern().getAsTemplateDecl() &&
TemplateArg.NumExpansions == Other.TemplateArg.NumExpansions;
 
   case Declaration:
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D126172: [clang] Fix comparison of TemplateArgument when they are of template kind

2022-06-01 Thread Robert Esclapez via Phabricator via cfe-commits
roberteg16 added a comment.

@rsmith polite ping


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D126172

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D126172: [clang] Fix comparison of TemplateArgument when they are of template kind

2022-06-02 Thread Robert Esclapez via Phabricator via cfe-commits
roberteg16 added a comment.

Thanks @mizvekov for such an insightful review. I'll try to address ASAP 
everything you said and let you know the results.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D126172

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits