[LLVMbugs] [Bug 6532] New: Dependent name not checked for same-type constraint in conversion-function-id

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Mar 7 07:19:37 PST 2010


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

           Summary: Dependent name not checked for same-type constraint in
                    conversion-function-id
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: schaub-johannes at web.de
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


The Standard requires that (unqualified) lookup in the context of the
postfix-expression should find the same type as does a lookup in the scope of
the object expression (see 3.4.5[basic.lookup.classref] paragraph 7). Clang
does not check this:

template<typename>
struct A {
  // if we change the typedef to "short", clang
  // should complain.
  typedef int foo; 
  operator int() {
    return 0;
  }
};

template<typename>
struct B {
  // this is not found, because B<T> is a dependent base.
  typedef short foo;
};

// makes sure applicable name-lookup
// on definition context classifies "foo"
// as a type so it matches the syntax.
struct TypeNameSugar {
  typedef int foo;
};

template<typename T>
struct C : A<T>, B<T>, TypeNameSugar {
  void c() {
    A<T> *p = this;

    // dependent "p" makes "foo" a dependent name.
    p->operator foo();
  }
};

int main() {
  C<void>().c();
}

-- 
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