https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80368

            Bug ID: 80368
           Summary: g++ thinks sizeof a non-type template parameter is
                    dependent
           Product: gcc
           Version: 6.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: aschepler at gmail dot com
  Target Milestone: ---

g++ rejects the following valid code:

template <unsigned int N>
struct A {
    static constexpr unsigned int value = N;
};

template <unsigned int N>
struct B : public A<sizeof(N)> {
    static constexpr unsigned int member = value;
};

claiming "value" was not declared in the scope of B<N>.

Standard section 14.6.2 is clear: sizeof unary-expression is never
type-dependent, and is only value-dependent if the unary-expression is
type-dependent.  But (N) is only value-dependent, so sizeof(N) is not dependent
at all.  Name lookup should include members of all non-dependent base classes.

Reply via email to