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

             Bug #: 57196
           Summary: [4.8 regression] Bogus "aggregate ... has incomplete
                    type and cannot be defined"
    Classification: Unclassified
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: ppluzhni...@google.com


Google ref: b/8853908

Test case reduced from gUnit.

#include <set>
#include <string>

using std::set;
using std::string;

int& IsNullLiteralHelper(...);

template <size_t> struct EqHelper { };

void Fn() {
  EqHelper<sizeof IsNullLiteralHelper(set<int>{1})>        eq1;  // ok
  EqHelper<sizeof IsNullLiteralHelper(set<string>())>      eq2;  // ok
  EqHelper<sizeof IsNullLiteralHelper(set<string>{"foo"})> eq3;  // error
}


Using trunk built at r198689:


g++  -std=c++11 -c tt.cc
tt.cc: In function ‘void Fn()’:
tt.cc:14:60: error: aggregate ‘EqHelper<sizeof
(IsNullLiteralHelper(std::set<std::basic_string<char>
>(std::initializer_list<std::basic_string<char> >{((const
std::basic_string<char>*)(& const std::basic_string<char>
[1]{std::basic_string<char>(((const char*)"foo"), (*(const
std::allocator<char>*)(& std::allocator<char>())))})), 1u}, (*(const
std::less<std::basic_string<char> >*)(& std::less<std::basic_string<char>
>())), (*(const std::allocator<std::basic_string<char> >*)(&
std::allocator<std::basic_string<char> >())))))> eq3’ has incomplete type and
cannot be defined
   EqHelper<sizeof IsNullLiteralHelper(set<string>{"foo"})> eq3;
                                                            ^

Reply via email to