Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[temp.arg.explicit,temp.mem] Clarify note about explicit template arg… #2043

Merged
merged 1 commit into from Jun 27, 2018

Conversation

jensmaurer
Copy link
Member

…uments

for conversion function templates and constructor templates.

Fixes #2041.

@jensmaurer jensmaurer added this to the C++20 milestone Apr 19, 2018
@@ -2472,9 +2472,11 @@
\end{codeblock}
\end{example}
\begin{note}
%% Ed. note: Using \iref would cause an overflowing \hbox; changing
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought we'd fixed \iref so that we can break before it, just with a high penalty? :(

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Except that, when I tried it, it didn't work in this case.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps we could add an optional parameter to \iref to specify its \nolinebreak penalty. I'm sad that it doesn't "just work" here; it definitely does work in other places, such as [class.dtor]p14, but IIRC turning down the line break penalty any further globally causes TeX to wrap inline references even in places where it's unnecessary to do so.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From https://tex.stackexchange.com/questions/94217/what-is-the-difference-between-nobreak-and-nolinebreak it looks like we're probably effectively using \penalty 301 currently (that's for article, but I'd guess memoir is probably not very different). Maybe we could binary search to find whatever value works in this case and try changing \iref to use something like that.

name, and because conversion member function templates and constructor
member function templates are called without using a function name,
name (\ref{temp.arg.explicit}), and because conversion member function templates\iref{class.conv.fct}
are named without using a function name,
there is no way to provide an explicit template argument list for these
function templates.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The wording that remains here is wrong, isn't it? The reason you can't provide an explicit template argument list to a conversion function is simply because grammar productions for template-id do not include a production for a conversion-function-id followed by a template-argument-list. (The reason for that is presumably the visual ambiguity between template arguments of the conversion function and template arguments of its type, combined with there being no way to write operator T </*T=*/int>, since you can't name T.) But it seems simply wrong to say that conversion member function templates are called without using a function name; they can be.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like these "because" sentences in any case.

@jensmaurer jensmaurer added the needs rebase The pull request needs a git rebase to resolve merge conflicts. label May 7, 2018
@jensmaurer
Copy link
Member Author

Updated, and rephrased to avoid the overfull \hbox. The note in [temp.mem] now does conversion function templates, the note in [temp.arg.explicit] only does constructors.

@jensmaurer jensmaurer removed the needs rebase The pull request needs a git rebase to resolve merge conflicts. label May 7, 2018
template name, and because conversion member function templates and
constructor member function templates are called without using a
template name, and because
constructor member function templates\iref{class.ctor} are named without using a
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the change "are called" -> "are named" here intentional? I think it's clear that (for example) the expression A() calls a constructor without using a function name, and more generally, there is no syntax to call a constructor using a function name. However, it's not clear to me that template<typename T> A::A(T t) names the constructor without using a function name -- in that context, A::A names the constructor, and the constructor is a function, so arguably A::A is a function name.

Copy link
Member Author

@jensmaurer jensmaurer May 8, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[temp.arg.explicit] p2 lists the circumstances under which an explicit template argument list can be supplied for a function template. "A function is called" is just one of five options. I agree that "named" is bad term here, though, because we use "naming the constructor" when we want to weasel-word around the fact that constructors don't have names to start with. p1 talks about "function template name", and the note wants to highlight that a strict reading of "name" is required here (and thus constructors can't have template argument lists). Oh, and [class.qual] p2 has a lot of words to avoid mentioning the phrase "function name" for constructors, in particular for your declaration example.

I'll add a cross-reference.

There is no syntax to form a \grammarterm{template-id}\iref{temp.names}
by providing an explicit template argument
list\iref{temp.arg.explicit} for a conversion member function
template\iref{class.conv.fct}.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"conversion member function template" is an awkward phrase, as it splits the term "conversion function". The "member" here seems redundant, since every conversion function [template] is already a member function [template]. So how about replacing that with just "conversion function template"?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was there before...

template name, and because conversion member function templates and
constructor member function templates are called without using a
template name, and because
constructor member function templates\iref{class.ctor} are named without using a
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of "constructor member function templates", I think "constructor templates" would be clearer and easier to understand.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, pre-existing junk.

@jensmaurer
Copy link
Member Author

Updated.

…uments

for conversion function templates and constructor templates.
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.

None yet

2 participants