Date: Fri, 15 Nov 2019 23:23:06 -0500
I agree, the program is well-formed.
[dcl.fct.default]/9: When a declaration of a function is introduced by way
of a using-declaration, any default argument information associated with
the declaration is made known as well. If the function is redeclared
thereafter in the namespace with additional default arguments, the
additional arguments are also known at any point following the
redeclaration where the using-declaration is in scope.
A Note in [namespace.udecl] (paragraph 11 in C++17 draft N4659, or
paragraph 10 in a recent C++20 draft) also mentions this rule:
[ Note: For a using-declaration whose nested-name-specifier names a
namespace, members added to the namespace after the using-declaration are
not in the set of introduced declarations, so they are not considered when
a use of the name is made. Thus, additional overloads added after the
using-declaration are ignored, but default function arguments
([dcl.fct.default]), default template arguments ([temp.param]), and
template specializations ([temp.class.spec], [temp.expl.spec]) are
considered. — end note ]
-- Andrew Schepler
On Fri, Nov 15, 2019 at 7:48 AM Vladimir Grigoriev via Std-Discussion <
std-discussion_at_[hidden]> wrote:
> Confirm me that the *clang HEAD 10.0.0* has a bug or I missed something.
>
> The following demonstrative program instead of to output
>
> f( 10 )
>
>
> generates a compiler error when the *clang HEAD 10.0.0* compiler is used.
>
> #include <iostream>
>
> namespace N1
> {
> void f( int x ) { std::cout << "f( " << x << " )\n"; }
> }
>
> using N1::f;
>
> namespace N1
> {
> void f( int x = 10 );
> }
>
> int main()
> {
> f();
> }
>
>
> With nest regards,
>
> Vlad from Moscow
>
> You can meet me at http://cpp.forum24.ru/ or www.stackoverflow.com or
> http://ru.stackoverflow.com
> --
> Std-Discussion mailing list
> Std-Discussion_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-discussion
>
[dcl.fct.default]/9: When a declaration of a function is introduced by way
of a using-declaration, any default argument information associated with
the declaration is made known as well. If the function is redeclared
thereafter in the namespace with additional default arguments, the
additional arguments are also known at any point following the
redeclaration where the using-declaration is in scope.
A Note in [namespace.udecl] (paragraph 11 in C++17 draft N4659, or
paragraph 10 in a recent C++20 draft) also mentions this rule:
[ Note: For a using-declaration whose nested-name-specifier names a
namespace, members added to the namespace after the using-declaration are
not in the set of introduced declarations, so they are not considered when
a use of the name is made. Thus, additional overloads added after the
using-declaration are ignored, but default function arguments
([dcl.fct.default]), default template arguments ([temp.param]), and
template specializations ([temp.class.spec], [temp.expl.spec]) are
considered. — end note ]
-- Andrew Schepler
On Fri, Nov 15, 2019 at 7:48 AM Vladimir Grigoriev via Std-Discussion <
std-discussion_at_[hidden]> wrote:
> Confirm me that the *clang HEAD 10.0.0* has a bug or I missed something.
>
> The following demonstrative program instead of to output
>
> f( 10 )
>
>
> generates a compiler error when the *clang HEAD 10.0.0* compiler is used.
>
> #include <iostream>
>
> namespace N1
> {
> void f( int x ) { std::cout << "f( " << x << " )\n"; }
> }
>
> using N1::f;
>
> namespace N1
> {
> void f( int x = 10 );
> }
>
> int main()
> {
> f();
> }
>
>
> With nest regards,
>
> Vlad from Moscow
>
> You can meet me at http://cpp.forum24.ru/ or www.stackoverflow.com or
> http://ru.stackoverflow.com
> --
> Std-Discussion mailing list
> Std-Discussion_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-discussion
>
Received on 2019-11-15 22:25:38