Skip to content
Latchkey

gcc/clang "expected primary-expression before" in CI

The compiler reached a point where an expression was required but found something that cannot start one - often a type name used where a value was expected, or a missing operand.

What this error means

A parse error reports "expected primary-expression before" a token such as a type name, > or ), frequently after a template syntax or missing-argument mistake.

gcc
app.cpp:6:18: error: expected primary-expression before '>' token
    6 |   auto v = make<int>();
      |                  ^

Common causes

How to fix it

Supply a valid expression

  1. Replace the type with a value, or fix the missing operand.
  2. For dependent template calls, add the template disambiguator.
gcc
obj.template make<int>();   // template keyword for dependent name

How to prevent it

  • Use values (not bare type names) where expressions are required and add the template keyword for dependent member templates.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →