[LLVMbugs] [Bug 13074] New: Trailing return type can't handle decltype(&std::declval<foo>())

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Jun 10 15:39:13 PDT 2012


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

             Bug #: 13074
           Summary: Trailing return type can't handle
                    decltype(&std::declval<foo>())
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++11
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: bugzillas at petteriraty.eu
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


betelgeuse at pena ~/cpp $ cat decltype.cpp 
#include <utility>

struct foo;

foo* other(int i);

auto foo(int i) -> decltype(&std::declval<foo>()) {
  return other(i);
}
betelgeuse at pena ~/cpp $ clang++ -c -o decltype.o -std=c++11 decltype.cpp 
decltype.cpp:7:29: error: address expression must be an lvalue or a function
designator
auto foo(int i) -> decltype(&std::declval<foo>()) {
                            ^~~~~~~~~~~~~~~~~~~~
decltype.cpp:7:1: error: 'auto' return without trailing return type
auto foo(int i) -> decltype(&std::declval<foo>()) {
^
decltype.cpp:8:10: error: cannot initialize return object of type 'int' with an
rvalue of type 'foo *'
  return other(i);
         ^~~~~~~~
3 errors generated.
betelgeuse at pena ~/cpp $ g++ -c -o decltype.o -std=c++0x decltype.cpp 
betelgeuse at pena ~/cpp $
betelgeuse at pena ~/cpp $ clang++ --version
clang version 3.1 (branches/release_31)
Target: i386-pc-linux-gnu
Thread model: posix

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