0

This question is related to this one and has to be with the specific cases below

template<class T, class U = T> class B { };
template <class ... Types> class C {  };
template<template<class> class P> class X { };

X<B>{ }; // OK
X<C>{ }; // OK

The standard in [temp.arg.template]/3 has marked these two cases as OK but the last update on the defect CWG 150 says that the CWG has decided not take action yet. Neither clang nor gcc accept the code.

Are clang and gcc non-conformant?

Jans
  • 11,064
  • 3
  • 37
  • 45
  • The statement "The standard is wrong" does not compute. The standard is what it is; and clang or gcc either comply with the standard, or they do not. That's it. – Sam Varshavchik Sep 22 '18 at 19:44

1 Answers1

2

gcc accepts this since 7.1. clang intentionally does not accept it unless you provide a new flag:

Despite being the resolution to a Defect Report, this feature is disabled by default in all language versions, and can be enabled explicitly with the flag -frelaxed-template-template-args in Clang 4 onwards. The change to the standard lacks a corresponding change for template partial ordering, resulting in ambiguity errors for reasonable and previously-valid code. This issue is expected to be rectified soon.

For examples of said breaking code, see this question.

Compilation demo.


Also the latest update on the Core Issue in question is that it was:

[Moved to DR at the November, 2016 meeting as paper P0522R0.]

It's just at the top of the issue instead of the bottom. I added the link.

Barry
  • 286,269
  • 29
  • 621
  • 977