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



             Bug #: 56516

           Summary: problem parsing templates: object.field < 10

                    interpreted as ill formed template

    Classification: Unclassified

           Product: gcc

           Version: unknown

            Status: UNCONFIRMED

          Severity: normal

          Priority: P3

         Component: c++

        AssignedTo: unassig...@gcc.gnu.org

        ReportedBy: walter.mascaren...@gmail.com





// The following code illustrates what I consider to be a bug in

// g++ 4.7.2 with options -std=c++11 -g -Wall, with Qt 5.0.1 in Ubuntu 12.04

LTS



template <typename T>

inline

int field(T const&)

{

  return 0;

}



template <typename T>

struct Foo

{

  int field;

};



template <typename N>

inline

void useFoo()

{

  Foo<N> foo;



  // the next line causes the error "parse error in template argument list"

  // g++ seems to be considering foo.field< 10  as some ill formed

  // invocation of the template function field

  for( ; foo.field < 10; )

  {

  }

}



int main()

{

  useFoo<int>();

  return 0;

}

Reply via email to