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

            Bug ID: 104319
           Summary: "parse error of template argument list" due to missing
                    space in ">==", a better error message should be given
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: nickhuang99 at hotmail dot com
  Target Milestone: ---

consider following code (https://www.godbolt.org/z/4drb17Pqn):

template<typename T>
struct A{ 
    constexpr static int value=0;
};

template<typename T>
constexpr int Zero=A<T>::value;
static_assert(Zero<int>==0);

<source>:8:15: error: parse error in template argument list
    8 | static_assert(Zero<int>==0);
      |               ^~~~~~~~~~~~
<source>:8:15: error: template argument 1 is invalid
Compiler returned: 1


clang gives much clear reason: 
error: a space is required between a right angle bracket and an equals sign
(use '> =')
static_assert(Zero<int>==0);
                      ^~
                      > =

clearly "Zero<int>" can be considered template id to avoid template argument
list error message.

Reply via email to