[LLVMbugs] [Bug 7290] New: Sometimes the 'aka' type is better than the user's typedef.

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Jun 2 23:45:49 PDT 2010


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

           Summary: Sometimes the 'aka' type is better than the user's
                    typedef.
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Keywords: quality-of-implementation
          Severity: enhancement
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: jyasskin at google.com
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


For example:

$ cat test.cc
template<typename T> struct identity { typedef T type; };
template <typename T>
T max(T lhs, typename identity<T>::type rhs);

void Use() {
  max(3, "Oops");
}
$ ./clang++ -fsyntax-only test.cc
test.cc:6:3: error: no matching function for call to 'max'
  max(3, "Oops");
  ^~~
test.cc:3:3: note: candidate function [with T = int] not viable: no known
conversion from 'char const [5]' to 'typename identity<int>::type' (aka 'int')
for 2nd argument
T max(T lhs, typename identity<T>::type rhs);
  ^
1 error generated.
$ 



We might guess this based on the 'aka' type being shorter, but that won't
always be right. I suspect it'll be useful to have an attribute to let the user
tell clang which type to present.

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