This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/58130] New: [C++11] Compilation fails using "const decltype(...)& getter() const {...}"


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58130

            Bug ID: 58130
           Summary: [C++11] Compilation fails using "const decltype(...)&
                    getter() const {...}"
           Product: gcc
           Version: 4.8.2
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vittorio.romeo at outlook dot com

Tested both on Windows 8 x86 and Arch Linux x64.
Compiling with "-O3 -Wall -Wextra -pedantic"

    struct myStruct
    {
        std::vector<std::unique_ptr<ItemBase>> items;
        ...

    // This compiles with g++ 4.8.2 and clang++ 3.4
    inline const std::vector<std::unique_ptr<ItemBase>>& getItems() const    {
return category->getItems(); }

    // This DOES NOT compile with g++ 4.8.2, but compiles with clang++ 3.4
    inline const decltype(items)& getItems() const    { return
category->getItems(); }

    }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]