[LLVMbugs] [Bug 22842] New: Instantiated CXXMethods are not always added at any DeclContext

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Mar 7 23:50:18 PST 2015


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: unassignedbugs at nondot.org
          Reporter: yaron.keren at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150308/fd5f355e/attachment.html>


More information about the llvm-bugs mailing list