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

            Bug ID: 89682
           Summary: g++9 incorrectly disallows using private static method
                    as default arg to ctor of template type
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redbeard0531 at gmail dot com
  Target Milestone: ---

New in GCC9. No other compiler errors on this:

https://godbolt.org/z/480KfZ

template <typename T>
class C {
    class TagType {};
public:
    C(int, TagType = makeTag());
private:
    static TagType makeTag();
};

void test() {
    C<int>(1);
}


> g++ -fsyntax-only    ./creduce_repro/test.ii
./creduce_repro/test.ii: In function ‘void test()’:
./creduce_repro/test.ii:5:29: error: ‘static C<T>::TagType C<T>::makeTag()
[with T = int]’ is private within this context
    5 |     C(int, TagType = makeTag());
      |                      ~~~~~~~^~
./creduce_repro/test.ii:7:20: note: declared private here
    7 |     static TagType makeTag();
      |                    ^~~~~~~

Reply via email to