Declaring an incomplete type template parameter in an argument list

I have seen usage like:

boost::error_info<struct tag_name, std::string> name_info; 

Here tag_name names an incomplete type and the struct keyword preceding it seems to declare it in place, rather than a little more verbose:

 struct tag_name; boost::error_info<tag_name, std::string> name_info; 

What is the relevant part of the standard that allows this?

+5
source share
1 answer

Section 3.3.4 / 2 indicates how specifiers of specified types are developed in any situation, and what effect they may have:

If the specified type specifier is entered by the class key and this search does not find the previously declared type name [..] The developed type specifier is a declaration that introduces class-name, as described in section 3.3.2 .

Then in ยง3.3.2 / 7 (.2) it reads

The declaration point of the class first declared in the specified type specifier is as follows: [..] for the specified form specifier type

key class Identifier

if the specified type specifier is used in the qualifier-description-seq or parameter-declaration-sentence of the function defined in the namespace area, the identifier is declared as the class name in the namespace, contains a declaration; otherwise, with the exception of the friend declaration, the identifier is declared in the smallest namespace or block area containing the declaration.

+6
source

All Articles