[PATCH] D23492: Make function local tags visible.

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 15 11:25:44 PDT 2016

rsmith added inline comments.

Comment at: lib/Sema/SemaLookup.cpp:1546-1548
@@ -1545,5 +1549,5 @@
     // definition of it, because parameters aren't "within" the definition.
     if ((D->isTemplateParameter() || isa<ParmVarDecl>(D))
             ? isVisible(SemaRef, cast<NamedDecl>(DC))
             : SemaRef.hasVisibleDefinition(cast<NamedDecl>(DC))) {
       if (SemaRef.ActiveTemplateInstantiations.empty() &&
This check should already do the right thing for the case of a function-scope declaration.

Comment at: test/Modules/Inputs/PR28794/Subdir/LibBHeader.h:6-10
@@ +5,7 @@
+template <typename T, size_t SlabSize, size_t SizeThreshold>
+void *operator new(size_t, BumpPtrAllocatorImpl<T, SlabSize, SizeThreshold> &) {
+  struct S {};
+  return (void*)0xdead;
We should not be instantiating this template in the first place: the template definition should not be visible within pr28794.cpp because the LibBHeader.h submodule is never imported. I would guess the bug is that we're missing a visibility check for the template definition when we trigger the instantiation here.



More information about the cfe-commits mailing list