https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83345

            Bug ID: 83345
           Summary: c++1z produces an infinite recursion (c++1y works
                    fine).
           Product: gcc
           Version: 7.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pawel_sikora at zoho dot com
  Target Milestone: ---

% g++ bug.cpp -std=c++1y -Wall -Wextra && ./a.out; echo $?
0

% g++ bug.cpp -std=c++1z -Wall -Wextra && ./a.out; echo $?
zsh: segmentation fault (core dumped)  ./a.out
139


% cat bug.cpp 
    struct NullType {};

    struct ICondition
    {
        virtual ~ICondition() {}
    };

    template < class Arg1 = NullType >
    struct ConditionRefProxy
    {
        ConditionRefProxy( const ICondition& ) {}
    };

    template < class Arg1 = NullType >
    struct AndGroup : ICondition
    {
        typedef ConditionRefProxy< Arg1 > ref_proxy_t;

        operator ref_proxy_t( void )
        {
            return ref_proxy_t( *this );
        }

    };

int main()
{
    typedef AndGroup< NullType > A;
    A a;
    a.operator A::ref_proxy_t();
}

Reply via email to