https://bugs.kde.org/show_bug.cgi?id=368067

--- Comment #2 from Milian Wolff <m...@milianw.de> ---
We put the declarations of the template type parameters into the parent
context, which confuses our lookup. The solution would be to wrap those into
their own context, and then import that one into the ClassTemplate context. Or
maybe put them directly into the class template.

clang gives us:

AST tree successfully generated
ClassDecl (4) | type: "Foo" (105) | display: "Foo" | loc:
tests/files/bug367893.cpp@[(1,1),(1,10)] | sp-name-range: [(1,7),(1,10)] |
isDecl
ClassTemplate (31) | display: "Bar<Foo>" | loc:
tests/files/bug367893.cpp@[(2,1),(2,33)] | sp-name-range: [(2,30),(2,33)] |
isDecl
  TemplateTypeParameter (27) | type: "Foo" (1) | canonical type:
"type-parameter-0-0" (1) | display: "Foo" | loc:
tests/files/bug367893.cpp@[(2,10),(2,22)] | sp-name-range: [(2,19),(2,22)] |
isDecl
ClassDecl (4) | type: "Foo" (105) | display: "Foo" | loc:
tests/files/bug367893.cpp@[(4,1),(4,26)] | sp-name-range: [(4,7),(4,10)] |
isDecl
  CXXMethod (21) | type: "void ()" (111) | display: "foo()" | loc:
tests/files/bug367893.cpp@[(4,13),(4,23)] | sp-name-range: [(4,18),(4,21)] |
isDecl
CXXMethod (21) | type: "void ()" (111) | display: "foo()" | loc:
tests/files/bug367893.cpp@[(6,1),(6,21)] | sp-name-range: [(6,11),(6,14)] |
isDecl
  TypeRef (43) | type: "Foo" (105) | display: "class Foo" | loc:
tests/files/bug367893.cpp@[(6,6),(6,9)] | sp-name-range: [(6,6),(6,9)] | isUse
  CompoundStmt (202) | loc: tests/files/bug367893.cpp@[(6,17),(6,21)] |
sp-name-range: [(0,0),(0,0)] 
no problems encountered during parsing

we build:

  Top-Context "Global" (owner:  0x0 ) 0x7f3fcc004460 "" [ "" ] [ (0, 0)  -> 
(2147483647, 2147483647) ] "/tmp/testfile_Bh5300.cpp" 
     Declaration: "Foo" [ "Foo" ] 0x7f3fcc04a400 (internal ctx: 0x0 ) [ (1, 14)
 ->  (1, 17) ] , no definition,  1 use(s). 
       File: "/tmp/testfile_Bh5300.cpp" 
         Use: [ (6, 13)  ->  (6, 16) ] 
     Declaration: "Foo Foo" [ "Foo" ] 0x7f3fcc086f60 (internal ctx: 0x0 ) [ (2,
26)  ->  (2, 29) ] , no definition,  1 use(s). 
       File: "/tmp/testfile_Bh5300.cpp" 
         Use: [ (6, 13)  ->  (6, 16) ] 
     Declaration: "Bar" [ "Bar" ] 0x7f3fcc086e40 (internal ctx: 0x0 ) [ (2, 37)
 ->  (2, 40) ] , no definition,  0 use(s). 
     Declaration: "class Foo" [ "Foo" ] 0x7f3fcc0873a0 (internal ctx:
0x7f3fcc072cb0 ) [ (4, 14)  ->  (4, 17) ] , defined,  1 use(s). 
       File: "/tmp/testfile_Bh5300.cpp" 
         Use: [ (6, 13)  ->  (6, 16) ] 
    Context "Class" (owner:  0x7f3fcc0873a0 ) 0x7f3fcc072cb0 "Foo" [ "Foo" ] [
(4, 8)  ->  (4, 33) ] "" 
       1 Declarations, 1 child-contexts 
      Context "Function" (owner:  0x7f3fcc087e90 ) 0x7f3fcc086e10 "foo" [
"Foo::foo" ] [ (4, 20)  ->  (4, 30) ] "" 
         0 Declarations, 0 child-contexts 
    Context "Helper" (owner:  0x0 ) 0x7f3fcc087010 "Foo" [ "Foo" ] [ (6, 8)  ->
 (6, 28) ] "" 
       1 Declarations, 1 child-contexts 
      Context "Function" (owner:  0x7f3fcc0879c0 ) 0x7f3fcc087a00 "foo" [
"Foo::foo" ] [ (6, 8)  ->  (6, 28) ] "" 
         0 Declarations, 1 child-contexts 
        Context "Other" (owner:  0x0 ) 0x7f3fcc0a2170 "" [ "Foo::foo" ] [ (6,
24)  ->  (6, 28) ] "" 
           0 Declarations, 0 child-contexts

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to