[Bug c++/55778] Variadic template extension possibly wrong

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Dec 21 19:43:00 GMT 2012


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55778

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-12-21 19:42:45 UTC ---
(In reply to comment #2)
> I've always heard that the implementation order should not have an impact on
> the final result.
> 
> Am i rong again?

The problem isn't the order the function definitions (i.e. implementations)
appear in, it's the order they are declared in. A function that hasn't been
declared yet can't be called, that's pretty basic:

int f()
{
  return g(); // error
}

int g() { return 0; }

To make you code compile just declare the foo(const std::string&, Args...)
overload before any code needs to call it, so add its declaration before the
definition of foo(int, Args...)



More information about the Gcc-bugs mailing list