Lookup of dependent names in C++ template instantiation

后端 未结 3 1925
执笔经年
执笔经年 2021-02-07 05:11

When I try to compile this code

// void foobar(int); 

template 
struct Foo {
  void bar(T t) { foobar(t); };
};

void foobar(int);

template clas         


        
3条回答
  •  难免孤独
    2021-02-07 05:40

    Looks correct to me. While overload resolution is done only in phase 2, in phase 1 you already have to know that foobar(t) is a function call expression. If foobar names a type, t wouldn't even be a dependent name.

提交回复
热议问题