http://llvm.org/bugs/show_bug.cgi?id=22842

            Bug ID: 22842
           Summary: Instantiated CXXMethods are not always added at any
                    DeclContext
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    Classification: Unclassified

Instantiated CXXMethods (e.g. CXXConstructorDecl) in TemplateDeclInstantiator
(SemaTemplateInstantiateDecl.cpp) can go through one of two code paths.

1) Thru VisitFunctionTemplateDecl->VisitCXXMethodDecl->VisitCXXMethodDecl in
which case they are not added to the Owner DeclContext by VisitCXXMethodDecl 
due to 

  // If there's a function template, let our caller handle it.
  if (FunctionTemplate) {

but indeed added to DeclContext by the caller VisitFunctionTemplateDecl:

  Owner->addDecl(InstTemplate);

2) Thru VisitCXXConstructorDecl->VisitCXXMethodDecl->VisitCXXMethodDecl in
which case, although VisitCXXMethodDecl expects the caller to addDecl to the
DeclContext, it does not do so as far as I could follow the code.

I don't know if this is a bug but it does seem inconsistent behaviour between
the two cases and with comment.

Shouldn't all CXXMethods be addDecl-ed to some DeclConext?

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to