Bug 102665

Summary: test_glsl_to_tgsi_lifetime.cpp:53:67: error: ‘>>’ should be ‘> >’ within a nested template argument list
Product: Mesa Reporter: Vinson Lee <vlee>
Component: Mesa coreAssignee: mesa-dev
Status: RESOLVED FIXED QA Contact: mesa-dev
Severity: normal    
Priority: medium CC: gw.fossdev, prefect_
Version: 17.3Keywords: bisected, regression
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
i915 platform: i915 features:

Description Vinson Lee 2017-09-11 22:18:30 UTC
Build error with g++ 4.8.

$ make check
test_glsl_to_tgsi_lifetime.cpp:53:67: error: ‘>>’ should be ‘> >’ within a nested template argument list
    MockCodelineWithSwizzle(unsigned _op, const vector<pair<int,int>>& _dst,

$ g++ --version
g++ (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO

commit 7be6d8fe1250f3b1d5fb2347839567049526c5be
Author: Gert Wollny <gw.fossdev@gmail.com>
Date:   Fri Jun 30 08:37:36 2017 +0200

    mesa/st: glsl_to_tgsi: add tests for the new temporary lifetime tracker
    This patch adds a set of unit tests for the new lifetime tracker.
    Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Comment 1 Gert Wollny 2017-09-12 05:57:42 UTC
Strange,  this file should be compiled with c++11, the construct is legal c++11, this  and according to [1] g++4.8 should support it (right angle brackets N1757[2]).
Could you confirm that -std=s++11 or std=c++0x is actually set? - it is pulled in from the CLANG_CXXFKAGS and it might be that this is actually not done with older versions of clang. 

[1] https://gcc.gnu.org/gcc-4.8/cxx0x_status.html
[2] http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1757.html
Comment 2 Emil Velikov 2017-09-12 11:14:19 UTC
One option is to add space between the two >> - it's compatible with older C++ standards and part of Mesa already uses it.

Alternatively, move '&' one character to the right (again we have some instances in Mesa)

    MockCodelineWithSwizzle(unsigned _op, const vector<pair<int,int>> &_dst,
Comment 3 Gert Wollny 2017-09-12 14:28:14 UTC
@Vinson: on Travis with the exact same version of g++ you reported (gcc (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4 [1] the build runs through without modifying the source (I had to enable "make check" for this), so I'm a bit puzzles why it doesn't compile for you.

Could you check whether it build with the modification Emil suggested? 

[1] https://travis-ci.org/gerddie/mesa/jobs/274604922
Comment 4 Vinson Lee 2017-09-12 17:46:09 UTC
In the travis build, the -std=c++11 option comes from LLVM_CXXFLAGS with llvm-3.9. Older llvm versions or builds without llvm will not have -std=c++11.
Comment 5 Emil Velikov 2017-09-15 13:06:11 UTC
Should be fixed with

commit c75d78161046f34350467b53054ff4e9da7a5cdd
Author: Gert Wollny <gw.fossdev@gmail.com>
Date:   Wed Sep 13 15:03:34 2017 +0200

    mesa/st/tests: Correct build flags and force -std=c++11
Comment 6 Vinson Lee 2017-09-15 20:34:33 UTC
Still fails with g++-4.4.

  CXX    test_glsl_to_tgsi_lifetime.o
cc1plus: error: unrecognized command line option "-std=c++11"
Comment 7 Gert Wollny 2017-09-16 12:09:05 UTC
Isn't g++4.4 a bit old? It is not maintained since 2012[1].

Well, I can see whether I can disable compiling the tests for these older compilers where c++11 was not available or still experimental.  

[1] https://gcc.gnu.org/gcc-4.4/
Comment 8 Gert Wollny 2017-10-26 07:44:30 UTC
This patch should fix the bug by disabling building the tests when c++11 is not supported by the compiler: 


It is part of this series: 

Comment 9 Emil Velikov 2017-11-09 15:27:47 UTC
Should be addressed with
commit 09ad2576ece2f813e5be9dda60fdb0b9598d0d23
Author: Gert Wollny <gw.fossdev@gmail.com>
Date:   Wed Oct 18 17:05:25 2017 +0200

    configure: check for -std=c++11 support and enable st/mesa test accordingly

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.