[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#770670: g++: fails to compile in c++0x mode on ppc64el with std::vector and SDL



Package: g++
Version: 4.9.2-2
Severity: normal

Hi,

I'm trying to solve the build failure of my package vcmi on ppc64el:

https://buildd.debian.org/status/fetch.php?pkg=vcmi&arch=ppc64el&ver=0.97%2Bdfsg-2&stamp=1416356066

The issue seems to only appear when compiling with c++. It does not
happen when compiling with clang++. Thus I'm reporting this bug against
g++. Please reassign if this was the wrong conclusion.

The relevant first error message is:

[ 68%] Building CXX object AI/StupidAI/CMakeFiles/StupidAI.dir/main.cpp.o
cd /«BUILDDIR»/vcmi-0.97+dfsg/build/AI/StupidAI && /usr/bin/c++   -DFL_CPP11 -DM_BIN_DIR=\"/usr/games\" -DM_DATA_DIR=\"/usr/share/vcmi\" -DM_LIB_DIR=\"/usr/lib/powerpc64le-linux-gnu/vcmi\" -DStupidAI_EXPORTS -DUSE_SYSTEM_MINIZIP -g -O2 -fPIE -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2  -std=c++0x -Wall -Wextra -Wpointer-arith -Wno-strict-aliasing -Wno-switch -Wno-sign-compare -Wno-unused-local-typedefs  -Wno-unused-parameter -Wuninitialized -Wno-overloaded-virtual -Wno-type-limits  -fvisibility=hidden -O2 -g -DNDEBUG -fPIC -I/«BUILDDIR»/vcmi-0.97+dfsg -I/«BUILDDIR»/vcmi-0.97+dfsg/AI/StupidAI -I/«BUILDDIR»/vcmi-0.97+dfsg/lib     -Winvalid-pch -include "/«BUILDDIR»/vcmi-0.97+dfsg/build/AI/StupidAI/cotire/StupidAI_CXX_prefix.hxx"  -o CMakeFiles/StupidAI.dir/main.cpp.o -c /«BUILDDIR»/vcmi-0.97+dfsg/AI/StupidAI/main.cpp
/«BUILDDIR»/vcmi-0.97+dfsg/client/mapHandler.h:32:7: error: expected unqualified-id before '__attribute__'
  std::vector < std::pair<const CGObjectInstance*,SDL_Rect> > objects; //pointers to objects being on this tile with rects to be easier to blit this tile on screen
       ^
This only happens on ppc64el. I was able to track this issue down to a
combination of including SDL.h, using std::vector and compiling with
-std=c++0x.  In the following I will post some code and how I compile it and
the results on ppc64el (on the left) and amd64 (on the right).

Test 1
======

    $ cat test.cc
    #include "SDL.h"
    #include <vector>
    std::vector<int> foo;
    $ c++ -I/usr/include/SDL2 -c test.cc

 ppc64el                               | amd64
---------------------------------------|---------------------------------------
 success                               | success

Test 2
======

    $ cat test.cc
    #include "SDL.h"
    #include <vector>
    std::vector<int> foo;
    $ c++ -std=c++0x -I/usr/include/SDL2 -c test.cc

 ppc64el                               | amd64
---------------------------------------|---------------------------------------
 (failure log attached)                | success

Test 3
======

    $ cat test.cc
    #include "SDL.h"
    std::vector<int> foo;
    $ c++ -std=c++0x -I/usr/include/SDL2 -c test.cc


 ppc64el                               | amd64
---------------------------------------|---------------------------------------
 test.cc:4:6: error: expected          | test.cc:4:6: error: ‘vector’ in
 unqualified-id before ‘__attribute__’ | namespace ‘std’ does not name a
  std::vector<int> foo;                | template type
       ^                               |

Test 4
======

    $ cat test.cc
    #include "SDL.h"
    #include <vector>
    std::vector<int> foo;
    $ clang++ -std=c++0x -I/usr/include/SDL2 -c test.cc

 ppc64el                               | amd64
---------------------------------------|---------------------------------------
 success                               | success

The error in test 3 is what I see on ppc64el in the build log entry
above. It is probably just due to a missing "#include <vector>". But as
you can see, even if I "#include <vector>" I get an error as you can see
in test 2. It only seems to compile fine on ppc64el if I do not pass
-std=c++0x (test 1) or if one uses clang++ (test 4).

One lead that I have is the following. When compiling on ppc64el with
g++ and -std=c++0x, then the line:

    std::vector<int> foo

gets turned into

    std::__attribute__((altivec(vector__)))<int> foo

by the preprocessor (I checked with g++ -E).

This does not happen on amd64. It does also not happen with clang on
either architecture. It does also not happen without passing -std=c++0x.

Thanks!

cheers, josch
/usr/include/c++/4.9/bits/cpp_type_traits.h:98:24: error: expected primary-expression before ‘__attribute__’
       enum { __value = bool(_Sp::__value) || bool(_Tp::__value) };
                        ^
/usr/include/c++/4.9/bits/cpp_type_traits.h:98:24: error: expected ‘}’ before ‘__attribute__’
In file included from /usr/include/c++/4.9/bits/stl_algobase.h:61:0,
                 from /usr/include/c++/4.9/vector:60,
                 from test.cc:2:
/usr/include/c++/4.9/bits/cpp_type_traits.h:98:41: error: invalid use of qualified-name ‘_Sp::__value’
       enum { __value = bool(_Sp::__value) || bool(_Tp::__value) };
                                         ^
/usr/include/c++/4.9/bits/cpp_type_traits.h:98:41: error: expected ‘;’ at end of member declaration
/usr/include/c++/4.9/bits/cpp_type_traits.h:98:43: error: expected unqualified-id before ‘||’ token
       enum { __value = bool(_Sp::__value) || bool(_Tp::__value) };
                                           ^
/usr/include/c++/4.9/bits/cpp_type_traits.h:99:37: error: ‘__value’ was not declared in this scope
       typedef typename __truth_type<__value>::__type __type;
                                     ^
/usr/include/c++/4.9/bits/cpp_type_traits.h:99:44: error: template argument 1 is invalid
       typedef typename __truth_type<__value>::__type __type;
                                            ^
/usr/include/c++/4.9/bits/cpp_type_traits.h:99:60: error: invalid type in declaration before ‘;’ token
       typedef typename __truth_type<__value>::__type __type;
                                                            ^
/usr/include/c++/4.9/bits/cpp_type_traits.h:107:15: error: ‘__false_type’ does not name a type
       typedef __false_type __type;
               ^
/usr/include/c++/4.9/bits/cpp_type_traits.h:114:15: error: ‘__true_type’ does not name a type
       typedef __true_type __type;
               ^
/usr/include/c++/4.9/bits/cpp_type_traits.h:122:15: error: ‘__false_type’ does not name a type
       typedef __false_type __type;
               ^
/usr/include/c++/4.9/bits/cpp_type_traits.h:129:15: error: ‘__true_type’ does not name a type
       typedef __true_type __type;
               ^
/usr/include/c++/4.9/bits/cpp_type_traits.h:139:15: error: ‘__false_type’ does not name a type
       typedef __false_type __type;
               ^
/usr/include/c++/4.9/bits/cpp_type_traits.h:149:15: error: ‘__true_type’ does not name a type
       typedef __true_type __type;
               ^
/usr/include/c++/4.9/bits/cpp_type_traits.h:156:15: error: ‘__true_type’ does not name a type
       typedef __true_type __type;
               ^
/usr/include/c++/4.9/bits/cpp_type_traits.h:163:15: error: ‘__true_type’ does not name a type
       typedef __true_type __type;
               ^
/usr/include/c++/4.9/bits/cpp_type_traits.h:170:15: error: ‘__true_type’ does not name a type
       typedef __true_type __type;
               ^
/usr/include/c++/4.9/bits/cpp_type_traits.h:178:15: error: ‘__true_type’ does not name a type
       typedef __true_type __type;
               ^
/usr/include/c++/4.9/bits/cpp_type_traits.h:187:15: error: ‘__true_type’ does not name a type
       typedef __true_type __type;
               ^
/usr/include/c++/4.9/bits/cpp_type_traits.h:194:15: error: ‘__true_type’ does not name a type
       typedef __true_type __type;
               ^
/usr/include/c++/4.9/bits/cpp_type_traits.h:202:15: error: ‘__true_type’ does not name a type
       typedef __true_type __type;
               ^
/usr/include/c++/4.9/bits/cpp_type_traits.h:209:15: error: ‘__true_type’ does not name a type
       typedef __true_type __type;
               ^
/usr/include/c++/4.9/bits/cpp_type_traits.h:216:15: error: ‘__true_type’ does not name a type
       typedef __true_type __type;
               ^
/usr/include/c++/4.9/bits/cpp_type_traits.h:223:15: error: ‘__true_type’ does not name a type
       typedef __true_type __type;
               ^
/usr/include/c++/4.9/bits/cpp_type_traits.h:230:15: error: ‘__true_type’ does not name a type
       typedef __true_type __type;
               ^
/usr/include/c++/4.9/bits/cpp_type_traits.h:237:15: error: ‘__true_type’ does not name a type
       typedef __true_type __type;
               ^
/usr/include/c++/4.9/bits/cpp_type_traits.h:244:15: error: ‘__true_type’ does not name a type
       typedef __true_type __type;
               ^
/usr/include/c++/4.9/bits/cpp_type_traits.h:251:15: error: ‘__true_type’ does not name a type
       typedef __true_type __type;
               ^
/usr/include/c++/4.9/bits/cpp_type_traits.h:261:15: error: ‘__false_type’ does not name a type
       typedef __false_type __type;
               ^
/usr/include/c++/4.9/bits/cpp_type_traits.h:269:15: error: ‘__true_type’ does not name a type
       typedef __true_type __type;
               ^
/usr/include/c++/4.9/bits/cpp_type_traits.h:276:15: error: ‘__true_type’ does not name a type
       typedef __true_type __type;
               ^
/usr/include/c++/4.9/bits/cpp_type_traits.h:283:15: error: ‘__true_type’ does not name a type
       typedef __true_type __type;
               ^
/usr/include/c++/4.9/bits/cpp_type_traits.h:293:15: error: ‘__false_type’ does not name a type
       typedef __false_type __type;
               ^
/usr/include/c++/4.9/bits/cpp_type_traits.h:300:15: error: ‘__true_type’ does not name a type
       typedef __true_type __type;
               ^
/usr/include/c++/4.9/bits/cpp_type_traits.h:310:15: error: ‘__false_type’ does not name a type
       typedef __false_type __type;
               ^
/usr/include/c++/4.9/bits/cpp_type_traits.h:318:15: error: ‘__true_type’ does not name a type
       typedef __true_type __type;
               ^
/usr/include/c++/4.9/bits/cpp_type_traits.h:326:23: error: expected template-name before ‘<’ token
     : public __traitor<__is_integer<_Tp>, __is_floating<_Tp> >
                       ^
/usr/include/c++/4.9/bits/cpp_type_traits.h:326:23: error: expected ‘{’ before ‘<’ token
/usr/include/c++/4.9/bits/cpp_type_traits.h:326:23: error: expected unqualified-id before ‘<’ token
/usr/include/c++/4.9/bits/cpp_type_traits.h:334:23: error: expected template-name before ‘<’ token
     : public __traitor<__is_arithmetic<_Tp>, __is_pointer<_Tp> >
                       ^
/usr/include/c++/4.9/bits/cpp_type_traits.h:334:23: error: expected ‘{’ before ‘<’ token
/usr/include/c++/4.9/bits/cpp_type_traits.h:334:23: error: expected unqualified-id before ‘<’ token
/usr/include/c++/4.9/bits/cpp_type_traits.h:344:15: error: ‘__false_type’ does not name a type
       typedef __false_type __type;
               ^
/usr/include/c++/4.9/bits/cpp_type_traits.h:351:15: error: ‘__true_type’ does not name a type
       typedef __true_type __type;
               ^
/usr/include/c++/4.9/bits/cpp_type_traits.h:359:15: error: ‘__true_type’ does not name a type
       typedef __true_type __type;
               ^
/usr/include/c++/4.9/bits/cpp_type_traits.h:367:15: error: ‘__false_type’ does not name a type
       typedef __false_type __type;
               ^
/usr/include/c++/4.9/bits/cpp_type_traits.h:374:15: error: ‘__true_type’ does not name a type
       typedef __true_type __type;
               ^
/usr/include/c++/4.9/bits/cpp_type_traits.h:381:15: error: ‘__true_type’ does not name a type
       typedef __true_type __type;
               ^
/usr/include/c++/4.9/bits/cpp_type_traits.h:388:15: error: ‘__true_type’ does not name a type
       typedef __true_type __type;
               ^
/usr/include/c++/4.9/bits/cpp_type_traits.h:398:15: error: ‘__false_type’ does not name a type
       typedef __false_type __type;
               ^
/usr/include/c++/4.9/bits/cpp_type_traits.h:409:15: error: ‘__true_type’ does not name a type
       typedef __true_type __type;
               ^
/usr/include/c++/4.9/bits/cpp_type_traits.h:414:1: error: expected declaration before ‘}’ token
 } // namespace
 ^

Reply to: