Skip to content

Incorrect order of base-class initializers in class template [GH #302] - #318

Open
nv-cmeerw wants to merge 1 commit into
mainfrom
fix/302
Open

nv-cmeerw wants to merge 1 commit into
mainfrom
fix/302

Conversation

@nv-cmeerw

Copy link
Copy Markdown
Contributor

Fixes #302

Incorrect order of base-class initializers in class template

Previously, in the IL for prototype instantiations of class templates,
base-class mem-initializers with non-type template arguments could appear after
the initializers for other base classes. Such initializers are now recorded in
base-class declaration order when the base class can be identified.
Initializers for base classes that cannot yet be identified now retain their
source order relative to the next initializer for an identified nonvirtual
direct base class. For example, with --c++11:

  template<int> struct A { };
  struct B { };
  template<int N> struct C : A<N>, B {
    C() : A<N>(), B() { }      // Previously recorded as "B(), A<N>()".
    C(int) : A<+N>(), B() { }  // Previously recorded as "B(), A<+N>()".
  };

Both initializer lists are now recorded in the order shown.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dependent NTTP base mem-initializer emitted out of declaration order

1 participant