-
Notifications
You must be signed in to change notification settings - Fork 103
Open
Description
Consider the following case:
struct A {
operator char *();
};
inline namespace N {
char x(char *);
}
inline namespace M {
char x(long long *);
}
template <typename T> void f(char (*)[sizeof (x)(T{})]) {}
template <typename T> void f(char (*)[sizeof x(T{})]) {}
short x(const A &);
void g(char (*p)[sizeof(char)]) { f<A>(p); }
void h(char (*p)[sizeof(short)]) { f<A>(p); }
What scope the name x
belongs to is necessary unknown in the context of the calls from the template definitions.
As can be seen, both functions are callable with the same template arguments.
I do not see anything in the specification that provides a mangling for the parenthesized name.
Clang appears to handle this by using cp
in place of cl
for the call expression; however, this solution does not exactly handle the case where a unary &
operator either forms a pointer or a pointer-to-member:
struct A { int x; };
char q(int *);
short q(int A::*);
template <typename T>
int f(char (*)[sizeof(q(&T::x))]) { return 1; }
template <typename T>
int f(char (*)[sizeof(q(&(T::x)))]) { return 2; }
int g(char (*p)[sizeof(char)] = 0) { return f<A>(p); }
int h(char (*p)[sizeof(short)] = 0) { return f<A>(p); }
Metadata
Metadata
Assignees
Labels
No labels