\tl_new:N
  \l_example_tl
\cs_new_protected:Nn
  \example:
  {
    \tl_gset:Nn
      \l_example_tl  % error on this line
      { foo }
  }
