[llvm-bugs] [Bug 30331] New: hasDeclaration matcher doesn't match QualType wrapping ElaboratedType or TemplateSpecializationType

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Sep 8 11:39:31 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=30331

            Bug ID: 30331
           Summary: hasDeclaration matcher doesn't match QualType wrapping
                    ElaboratedType or TemplateSpecializationType
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: lukasza at chromium.org
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

This test fails at ToT:

TEST(HasDeclaration, QualTypeSpecializedTypeAndTemplateSpecializationType) {
  std::string input =
      "namespace Namespace {\n"
      "template<typename T>\n"
      "class Template {\n"
      " public:\n"
      "  void Method() {}\n"
      "};\n"
      "}  // namespace Namespace\n"
      "template <typename U>\n"
      "void Function(Namespace::Template<U> param) {\n"
      "  param.Method();\n"
      "};\n";

  // hasDeclaration should see through:
  // 1. from ElaboratedType (Namespace::MyTemplate<U>) to
  //    TemplateSpecializationType (MyTemplate<U>)
  // 2. from TemplateSpecializationType (MyTemplate<U>)
  //    to TemplateDecl (MyTemplate<T>).
  EXPECT_TRUE(matches(input, parmVarDecl(
      hasName("param"),
      hasType(qualType(hasDeclaration(decl(anything())))))));
}

The test failure is unexpected, because a parmVarDecl's type should always have
a declaration (right?).

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160908/48897f31/attachment.html>


More information about the llvm-bugs mailing list