[LLVMbugs] [Bug 10405] New: Missing actual type in error message when using decltype as a template parameter

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Jul 19 02:37:18 PDT 2011


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

           Summary: Missing actual type in error message when using
                    decltype as a template parameter
           Product: clang
           Version: trunk
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Keywords: quality-of-implementation
          Severity: normal
          Priority: P
         Component: C++0x
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: jonathan.sauer at gmx.de
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


The following program intentionally does not compile:

template <typename>
struct Foo { };

template <typename T, typename U>
auto foo(T t, U u) -> Foo<decltype(t + u)>;

int main(int, char**)
{
  int i = foo(1, 2);
}


With clang r135379, this results in the following message:

$ clang -std=c++0x clang.cpp 
clang.cpp:9:6: error: no viable conversion from 'Foo<decltype(t + u)>' to 'int'
        int i = foo(1, 2);
            ^   ~~~~~~~~~
1 error generated.


It would be helpful, if clang displayed the actual type here, just as it does
with template parameters in many other situations. In this case, the message
should read:

  no viable conversion from 'Foo<decltype(t + u)>' (aka 'Foo<int>') to 'int'

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