Relaxed template template argument matching C++17/DR rules will be enabled by default

Hello,

We are working here on a patch to finally complete C++17 support, making the effects of -frelaxed-template-template-args on by default, and deprecating that flag.

While this change came with C++17, it is a defect report and we are going to be applying it to all language versions.

We are implementing some provisional rules to solve a core issue which was the reason the flag was never on by default.

GCC has a similar change, but with slightly different rules, with less satisfactory results.

However, this is a breaking change nonetheless. Besides rejecting some previously accepted code, there are some circunstances where different overloads or specializations can be picked.

I would appreciate any early testing and feedback in that merge request.

Thanks.

1 Like

This was just merged.

We are working on further changes to lessen any potential breakages.

Example

template<class T2> struct A;
template<template<class ...T3s> class TT1, class T4> struct A<TT1<T4>>;
template<template<class    T5 > class TT2, class T6> struct A<TT2<T6>> {};

template<class T1> struct B;
template struct A<B<char>>;

This will compile fine, and we will be the first implementation offering this workaround.