Why does the C++ standard define two phase lookup for templates? Couldn\'t non dependent declarations and definitions\' lookups be deferred to the instantiation stage as wel
This could be viewed as an application of separation of concerns.
At the first phase it just checks for correct syntax, and resolves non-dependent names, as explained here. At the second phase it does something more template specific, verifying if the calls are valid with the specific types. See this [answer] ( Two phase lookup - explanation needed)
Furthermore, if it would be done in only one phase, then it should be done every instantiation. This way is done only once.
If would be done only on the first instantiation, then it would be the same thing, only less structured.