xinguai / googletest

Automatically exported from code.google.com/p/googletest
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

ICC (Intel C++ compiler) unab le to compile gtest code. #100

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Compile gtest then cd into make/
2. Change CXX to CXX=icpc in make/Makefile. 
3. Run make

What is the expected output? What do you see instead?

I expected to see the code compile and run fine.

What version of the product are you using? On what operating system?

Linux yk-dev-yg.corp.nanometrics.com 2.6.27.9-159.fc10.i686 #1 SMP Tue Dec
16 15:12:04 EST 2008 i686 i686 i386 GNU/Linux

gtest-1.2.1

icc (ICC) 11.0 20080930

Please provide any additional information below.

Here is the output of make:

icpc -I.. -I../include -g -c ../samples/sample1.cc
icpc -I.. -I../include -g -c ../samples/sample1_unittest.cc
/usr/include/c++/4.3.2/tr1/tuple(74): error: expected an identifier
    template<int _Idx, typename... _Elements>
                               ^

/usr/include/c++/4.3.2/tr1/tuple(82): error: too few arguments for class
template "std::tr1::_Tuple_impl"
      struct _Tuple_impl<_Idx> { };
                             ^

/usr/include/c++/4.3.2/tr1/tuple(89): error: expected an identifier
    template<int _Idx, typename _Head, typename... _Tail>
                                               ^

/usr/include/c++/4.3.2/tr1/tuple(90): error: type name is not allowed
      struct _Tuple_impl<_Idx, _Head, _Tail...>
                               ^

/usr/include/c++/4.3.2/tr1/tuple(90): error: too many arguments for class
template "std::tr1::_Tuple_impl"
      struct _Tuple_impl<_Idx, _Head, _Tail...>
                                    ^

/usr/include/c++/4.3.2/tr1/tuple(132): error: expected an identifier
    template<typename... _Elements> 
                     ^

/usr/include/c++/4.3.2/tr1/tuple(133): error: identifier "_Elements" is
undefined
      class tuple : public _Tuple_impl<0, _Elements...>
                                          ^

/usr/include/c++/4.3.2/tr1/tuple(133): error: expected a ">"
      class tuple : public _Tuple_impl<0, _Elements...>
                                                   ^

/usr/include/c++/4.3.2/tr1/tuple(133): error: not a class or struct name
      class tuple : public _Tuple_impl<0, _Elements...>
                           ^

/usr/include/c++/4.3.2/tr1/tuple(135): error: expected a ">"
        typedef _Tuple_impl<0, _Elements...> _Inherited;
                                        ^

/usr/include/c++/4.3.2/tr1/tuple(141): error: "_Elements" is not a type name
        tuple(typename __add_c_ref<_Elements>::type... __elements)
                                   ^

/usr/include/c++/4.3.2/tr1/tuple(141): error: expected a ")"
        tuple(typename __add_c_ref<_Elements>::type... __elements)
                                                       ^

/usr/include/c++/4.3.2/tr1/tuple(144): error: expected an identifier
        template<typename... _UElements>
                         ^

/usr/include/c++/4.3.2/tr1/tuple(145): error: identifier "_UElements" is
undefined
          tuple(const tuple<_UElements...>& __in)
                            ^

/usr/include/c++/4.3.2/tr1/tuple(145): error: expected a ">"
          tuple(const tuple<_UElements...>& __in)
                                      ^

/usr/include/c++/4.3.2/tr1/tuple(151): error: expected an identifier
        template<typename... _UElements>
                         ^

/usr/include/c++/4.3.2/tr1/tuple(153): error: identifier "_UElements" is
undefined
          operator=(const tuple<_UElements...>& __in)
                                ^

/usr/include/c++/4.3.2/tr1/tuple(153): error: expected a ">"
          operator=(const tuple<_UElements...>& __in)
                                          ^

/usr/include/c++/4.3.2/tr1/tuple(167): error: too few arguments for class
template "std::tr1::tuple"
    template<> class tuple<> { };
                           ^

/usr/include/c++/4.3.2/tr1/tuple(171): error: type name is not allowed
      class tuple<_T1, _T2> : public _Tuple_impl<0, _T1, _T2>
                  ^

/usr/include/c++/4.3.2/tr1/tuple(171): error: too many arguments for class
template "std::tr1::tuple"
      class tuple<_T1, _T2> : public _Tuple_impl<0, _T1, _T2>
                     ^

/usr/include/c++/4.3.2/tr1/tuple(232): error: expected an identifier
    template<int __i, typename _Head, typename... _Tail>
                                              ^

/usr/include/c++/4.3.2/tr1/tuple(233): error: type name is not allowed
      struct tuple_element<__i, tuple<_Head, _Tail...> >
                                      ^

/usr/include/c++/4.3.2/tr1/tuple(233): error: too many arguments for class
template "std::tr1::tuple"
      struct tuple_element<__i, tuple<_Head, _Tail...> >
                                           ^

/usr/include/c++/4.3.2/tr1/tuple(239): error: expected an identifier
    template<typename _Head, typename... _Tail>
                                     ^

/usr/include/c++/4.3.2/tr1/tuple(240): error: type name is not allowed
      struct tuple_element<0, tuple<_Head, _Tail...> >
                                    ^

/usr/include/c++/4.3.2/tr1/tuple(240): error: too many arguments for class
template "std::tr1::tuple"
      struct tuple_element<0, tuple<_Head, _Tail...> >
                                         ^

/usr/include/c++/4.3.2/tr1/tuple(240): error: invalid partial
specialization -- class "std::tr1::tuple_element<0, <error-type>>" is
already fully specialized
      struct tuple_element<0, tuple<_Head, _Tail...> >
             ^

/usr/include/c++/4.3.2/tr1/tuple(250): error: expected an identifier
    template<typename... _Elements>
                     ^

/usr/include/c++/4.3.2/tr1/tuple(251): error: expected a ">"
      struct tuple_size<tuple<_Elements...> >
                                       ^

/usr/include/c++/4.3.2/tr1/tuple(251): error: invalid partial
specialization -- class "std::tr1::tuple_size<<error-type>>" is already
fully specialized
      struct tuple_size<tuple<_Elements...> >
             ^

/usr/include/c++/4.3.2/tr1/tuple(256): error: expected an identifier
    template<typename... _Elements>
                     ^

/usr/include/c++/4.3.2/tr1/tuple(257): error: expected a ">"
      const int tuple_size<tuple<_Elements...> >::value;
                                          ^

/usr/include/c++/4.3.2/tr1/tuple(257): error: incomplete type is not allowed
      const int tuple_size<tuple<_Elements...> >::value;
                ^

/usr/include/c++/4.3.2/tr1/tuple(259): error: expected an identifier
    template<int __i, typename _Head, typename... _Tail>
                                              ^

/usr/include/c++/4.3.2/tr1/tuple(261): error: type name is not allowed
      __get_helper(_Tuple_impl<__i, _Head, _Tail...>& __t)
                                    ^

/usr/include/c++/4.3.2/tr1/tuple(261): error: too many arguments for class
template "std::tr1::_Tuple_impl"
      __get_helper(_Tuple_impl<__i, _Head, _Tail...>& __t)
                                         ^

/usr/include/c++/4.3.2/tr1/tuple(266): error: expected an identifier
    template<int __i, typename _Head, typename... _Tail>
                                              ^

/usr/include/c++/4.3.2/tr1/tuple(268): error: type name is not allowed
      __get_helper(const _Tuple_impl<__i, _Head, _Tail...>& __t)
                                          ^

/usr/include/c++/4.3.2/tr1/tuple(268): error: too many arguments for class
template "std::tr1::_Tuple_impl"
      __get_helper(const _Tuple_impl<__i, _Head, _Tail...>& __t)
                                               ^

/usr/include/c++/4.3.2/tr1/tuple(275): error: expected an identifier
    template<int __i, typename... _Elements>
                              ^

/usr/include/c++/4.3.2/tr1/tuple(277): error: expected a ">"
                        typename tuple_element<__i, tuple<_Elements...> >::type
                                                                   ^

/usr/include/c++/4.3.2/tr1/tuple(279): error: expected a ">"
      get(tuple<_Elements...>& __t)
                         ^

/usr/include/c++/4.3.2/tr1/tuple(284): error: expected an identifier
    template<int __i, typename... _Elements>
                              ^

/usr/include/c++/4.3.2/tr1/tuple(286): error: expected a ">"
                        typename tuple_element<__i, tuple<_Elements...> >::type
                                                                   ^

/usr/include/c++/4.3.2/tr1/tuple(288): error: expected a ">"
      get(const tuple<_Elements...>& __t)
                               ^

/usr/include/c++/4.3.2/tr1/tuple(325): error: expected an identifier
    template<typename... _TElements, typename... _UElements>
                     ^

/usr/include/c++/4.3.2/tr1/tuple(325): error: expected an identifier
    template<typename... _TElements, typename... _UElements>
                                             ^

/usr/include/c++/4.3.2/tr1/tuple(327): error: identifier "_TElements" is
undefined
      operator==(const tuple<_TElements...>& __t,
                             ^

/usr/include/c++/4.3.2/tr1/tuple(327): error: expected a ">"
      operator==(const tuple<_TElements...>& __t,
                                       ^

/usr/include/c++/4.3.2/tr1/tuple(328): error: identifier "_UElements" is
undefined
           const tuple<_UElements...>& __u)
                       ^

/usr/include/c++/4.3.2/tr1/tuple(328): error: expected a ">"
           const tuple<_UElements...>& __u)
                                 ^

/usr/include/c++/4.3.2/tr1/tuple(327): error: nonmember operator requires a
parameter with class or enum type
      operator==(const tuple<_TElements...>& __t,
      ^

/usr/include/c++/4.3.2/tr1/tuple(336): error: expected an identifier
    template<typename... _TElements, typename... _UElements>
                     ^

/usr/include/c++/4.3.2/tr1/tuple(336): error: expected an identifier
    template<typename... _TElements, typename... _UElements>
                                             ^

/usr/include/c++/4.3.2/tr1/tuple(338): error: identifier "_TElements" is
undefined
      operator<(const tuple<_TElements...>& __t,
                            ^

/usr/include/c++/4.3.2/tr1/tuple(338): error: expected a ">"
      operator<(const tuple<_TElements...>& __t,
                                      ^

/usr/include/c++/4.3.2/tr1/tuple(339): error: identifier "_UElements" is
undefined
          const tuple<_UElements...>& __u)
                      ^

/usr/include/c++/4.3.2/tr1/tuple(339): error: expected a ">"
          const tuple<_UElements...>& __u)
                                ^

/usr/include/c++/4.3.2/tr1/tuple(338): error: nonmember operator requires a
parameter with class or enum type
      operator<(const tuple<_TElements...>& __t,
      ^

/usr/include/c++/4.3.2/tr1/tuple(347): error: expected an identifier
    template<typename... _TElements, typename... _UElements>
                     ^

/usr/include/c++/4.3.2/tr1/tuple(347): error: expected an identifier
    template<typename... _TElements, typename... _UElements>
                                             ^

/usr/include/c++/4.3.2/tr1/tuple(349): error: identifier "_TElements" is
undefined
      operator!=(const tuple<_TElements...>& __t,
                             ^

/usr/include/c++/4.3.2/tr1/tuple(349): error: expected a ">"
      operator!=(const tuple<_TElements...>& __t,
                                       ^

/usr/include/c++/4.3.2/tr1/tuple(350): error: identifier "_UElements" is
undefined
           const tuple<_UElements...>& __u)
                       ^

/usr/include/c++/4.3.2/tr1/tuple(350): error: expected a ">"
           const tuple<_UElements...>& __u)
                                 ^

/usr/include/c++/4.3.2/tr1/tuple(349): error: nonmember operator requires a
parameter with class or enum type
      operator!=(const tuple<_TElements...>& __t,
      ^

/usr/include/c++/4.3.2/tr1/tuple(353): error: expected an identifier
    template<typename... _TElements, typename... _UElements>
                     ^

/usr/include/c++/4.3.2/tr1/tuple(353): error: expected an identifier
    template<typename... _TElements, typename... _UElements>
                                             ^

/usr/include/c++/4.3.2/tr1/tuple(355): error: identifier "_TElements" is
undefined
      operator>(const tuple<_TElements...>& __t,
                            ^

/usr/include/c++/4.3.2/tr1/tuple(355): error: expected a ">"
      operator>(const tuple<_TElements...>& __t,
                                      ^

/usr/include/c++/4.3.2/tr1/tuple(356): error: identifier "_UElements" is
undefined
          const tuple<_UElements...>& __u)
                      ^

/usr/include/c++/4.3.2/tr1/tuple(356): error: expected a ">"
          const tuple<_UElements...>& __u)
                                ^

/usr/include/c++/4.3.2/tr1/tuple(355): error: nonmember operator requires a
parameter with class or enum type
      operator>(const tuple<_TElements...>& __t,
      ^

/usr/include/c++/4.3.2/tr1/tuple(359): error: expected an identifier
    template<typename... _TElements, typename... _UElements>
                     ^

/usr/include/c++/4.3.2/tr1/tuple(359): error: expected an identifier
    template<typename... _TElements, typename... _UElements>
                                             ^

/usr/include/c++/4.3.2/tr1/tuple(361): error: identifier "_TElements" is
undefined
      operator<=(const tuple<_TElements...>& __t,
                             ^

/usr/include/c++/4.3.2/tr1/tuple(361): error: expected a ">"
      operator<=(const tuple<_TElements...>& __t,
                                       ^

/usr/include/c++/4.3.2/tr1/tuple(362): error: identifier "_UElements" is
undefined
           const tuple<_UElements...>& __u)
                       ^

/usr/include/c++/4.3.2/tr1/tuple(362): error: expected a ">"
           const tuple<_UElements...>& __u)
                                 ^

/usr/include/c++/4.3.2/tr1/tuple(361): error: nonmember operator requires a
parameter with class or enum type
      operator<=(const tuple<_TElements...>& __t,
      ^

/usr/include/c++/4.3.2/tr1/tuple(365): error: expected an identifier
    template<typename... _TElements, typename... _UElements>
                     ^

/usr/include/c++/4.3.2/tr1/tuple(365): error: expected an identifier
    template<typename... _TElements, typename... _UElements>
                                             ^

/usr/include/c++/4.3.2/tr1/tuple(367): error: identifier "_TElements" is
undefined
      operator>=(const tuple<_TElements...>& __t,
                             ^

/usr/include/c++/4.3.2/tr1/tuple(367): error: expected a ">"
      operator>=(const tuple<_TElements...>& __t,
                                       ^

/usr/include/c++/4.3.2/tr1/tuple(368): error: identifier "_UElements" is
undefined
           const tuple<_UElements...>& __u)
                       ^

/usr/include/c++/4.3.2/tr1/tuple(368): error: expected a ">"
           const tuple<_UElements...>& __u)
                                 ^

/usr/include/c++/4.3.2/tr1/tuple(367): error: nonmember operator requires a
parameter with class or enum type
      operator>=(const tuple<_TElements...>& __t,
      ^

/usr/include/c++/4.3.2/tr1/tuple(393): error: expected an identifier
    template<typename... _Elements>
                     ^

/usr/include/c++/4.3.2/tr1/tuple(394): error: "_Elements" is not a type name
      inline tuple<typename __strip_reference_wrapper<_Elements>::__type...>
                                                      ^

/usr/include/c++/4.3.2/tr1/tuple(394): error: type name is not allowed
      inline tuple<typename __strip_reference_wrapper<_Elements>::__type...>
                   ^

/usr/include/c++/4.3.2/tr1/tuple(394): error: expected a ">"
      inline tuple<typename __strip_reference_wrapper<_Elements>::__type...>
                                                                        ^

/usr/include/c++/4.3.2/tr1/tuple(395): error: "make_tuple" is not a
function or static data member
      make_tuple(_Elements... __args)
      ^

/usr/include/c++/4.3.2/tr1/tuple(395): error: expected a ";"
      make_tuple(_Elements... __args)
                 ^

/usr/include/c++/4.3.2/tr1/tuple(422): error: identifier "_Swallow_assign"
is undefined
      _Swallow_assign ignore;
      ^

../include/gtest/internal/gtest-param-util-generated.h(2670): error: type
name is not allowed
      : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2> > {
                                                          ^

../include/gtest/internal/gtest-param-util-generated.h(2670): error: too
many arguments for class template "std::tr1::tuple"
      : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2> > {
                                                            ^

../include/gtest/internal/gtest-param-util-generated.h(2672): error: type
name is not allowed
    typedef ::std::tr1::tuple<T1, T2> ParamType;
                              ^

../include/gtest/internal/gtest-param-util-generated.h(2672): error: too
many arguments for class template "std::tr1::tuple"
    typedef ::std::tr1::tuple<T1, T2> ParamType;
                                ^

../include/gtest/internal/gtest-param-util-generated.h(2779): error: type
name is not allowed
      : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3> > {
                                                          ^

compilation aborted for ../samples/sample1_unittest.cc (code 4)
gmake: *** [sample1_unittest.o] Error 4

Original issue reported on code.google.com by Sardathr...@gmail.com on 14 Jan 2009 at 10:40

GoogleCodeExporter commented 9 years ago
You are using gcc 4.3.2's <tr1/tuple> library with icc.  The former uses a gcc
extension that is apparently not supported by icc.

Unfortunately I don't have access to icc to work on this.  Please try to disable
tuple by adding this to your compiler flag:

-DGTEST_HAS_TR1_TUPLE=0

I'm closing this for now.  Please re-open it if this doesn't fix your problem.

Original comment by zhanyong...@gmail.com on 15 Jan 2009 at 11:29

GoogleCodeExporter commented 9 years ago
I can confirm that this solved the problem. 

You should get a copy of ICC, it is rather good.

Original comment by Sardathr...@gmail.com on 21 Jan 2009 at 11:20

GoogleCodeExporter commented 9 years ago
/usr/include/c++/4.3.2/tr1/tuple(74): error: expected an identifier
    template<int _Idx, typename... _Elements>

this is not a gcc extension.  Its part of the next c++ standard.  There is 
probably a
MACRO you can define that will make the standard libraries compile in legacy 
mode. 
Or some environment variable to tell icc to use and older copy of gcc's 
libraries.

It doesn't look like icc is compatible with gcc 4.3.  I would be worried about 
what
other subtle errors icc is making using a standard library it wasn't tested 
with. 
Does icc come with it's own standard library?

Original comment by j.nick.terry@gmail.com on 7 Mar 2009 at 1:01