https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112590
Mital Ashok <mital at mitalashok dot co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mital at mitalashok dot co.uk --- Comment #1 from Mital Ashok <mital at mitalashok dot co.uk> --- See [temp.arg.nontype]p3 <https://timsong-cpp.github.io/cppwp/n4868/temp.arg.nontype#3>: > For a non-type template-parameter of reference type, or for each non-static > data member of reference or pointer type in a non-type template-parameter > of class type or subobject thereof, the reference or pointer value shall > not refer to or be the address of (respectively): > - A temporary object, > - [...] > - a subject of one of the above. And "f_{a_}" is initializing the pointer as a subobject of a temporary object, so this is invalid. Though the error given might be wrong or misleading.