C++ Logo

STD-DISCUSSION

Advanced search

Subject: Re: Question about name lookup and class member?
From: Edward Catmur (ecatmur_at_[hidden])
Date: 2021-06-06 12:04:30


On Sun, 6 Jun 2021, 17:57 Eric Suen via Std-Discussion, <
std-discussion_at_[hidden]> wrote:

> The following code, how do parser know that V is template and B is not?
>

NSDMIs are evaluated in a complete-class context. This is one reason they
can't be `auto`.

struct A {
> int a = V<1>();
> bool b = B < 0;
>
> void print() {
> std::cout << a;
> }
>
> template<int v>
> static int V() {
> return v;
> }
>
> static int B;
> };
>
> int A::B = 1;
>
> int main() {
> A a;
> a.print();
> }
> --
> Std-Discussion mailing list
> Std-Discussion_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-discussion
>



STD-DISCUSSION list run by std-discussion-owner@lists.isocpp.org

Older Archives on Google Groups