Open Quuxplusone opened 10 years ago
Bugzilla Link | PR19742 |
Status | NEW |
Importance | P normal |
Reported by | Daniel Krügler (daniel.kruegler@gmail.com) |
Reported on | 2014-05-14 13:24:25 -0700 |
Last modified on | 2016-02-19 10:59:25 -0800 |
Version | trunk |
Hardware | PC Linux |
CC | dgregor@apple.com, droffset@yandex.ru, llvm-bugs@lists.llvm.org, pdaouadi@aldebaran-robotics.com, richard-llvm@metafoo.co.uk |
Fixed by commit(s) | |
Attachments | |
Blocks | |
Blocked by | |
See also |
Fixed in r208825, but I'm leaving this open because we're not done here yet. We
still incorrectly accept these:
template<typename T> struct S {
void f(T);
};
S<void () const> s1;
S<void () &> s2;
... because we don't properly validate the pointer type we build when
performing function-to-pointer decay.
(In reply to comment #1)
> Fixed in r208825, but I'm leaving this open because we're not done here yet.
> We still incorrectly accept these:
>
> template<typename T> struct S {
> void f(T);
> };
> S<void () const> s1;
> S<void () &> s2;
>
> ... because we don't properly validate the pointer type we build when
> performing function-to-pointer decay.
Good afternoon,
so, in the context of this question I would like to clarify, that this rule
(8.3.1/4):
"Forming a reference to function type is ill-formed if the function type has cv-
qualifiers or a ref-qualifier"
applicable for this code:
#include <iostream>
template <typename F>
void (* test()) (F);
template <typename X>
char (& probe( void(*) ( X * ) ) )[1];
template <typename X>
char (& probe( void(*) ( X ) ) )[2];
int main()
{
std::cout << sizeof(probe(test<void() const>()));
}
in context of C++14 standard (for versions 3.4 and earlier this code prints
"1", 3.5 and higher prints "2")?
And what about C++03 (in which there is no explicit limitation)? Behaviour
whould same, or not?