[LLVMbugs] [Bug 9167] New: Linkage of anonymous tag types defined in typedefs should not be cached

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Feb 8 11:42:49 PST 2011


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

           Summary: Linkage of anonymous tag types defined in typedefs
                    should not be cached
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: rjmccall at apple.com
                CC: llvmbugs at cs.uiuc.edu


The linkage of an anonymous tag type defined in a typedef can change. 
Currently we handle this by clearing the linkage cache for that tag and its
children, but it is quite possible to build arbitrary type expressions
involving that type, and we have no way of clearing the linkage of those types.
 dgregor points out that the only reasonable solution is to just not cache
linkage for tag types defined in typedefs until the end of the typedef.

The problem arises with things like this:

  template <class T> struct A { void foo(); };

  typedef struct {
    void foo() { A<decltype(this)>::foo(); }
  } B;

But also things like this:

  typedef struct {
    int x;
  } *B_ptr, B_returning_fn(A<B_ptr>), B;

Oh and by the way, you can put 'typedef' after the struct definition here, so
we just can't cache the linkage of anything involving an anonymous tag
definition until the end of that decl group.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list