[Bug c++/51210] New: [C++11][DR 547] std::type_info works incorrectly with function types with cv-qualifier-seq
daniel.kruegler at googlemail dot com
gcc-bugzilla@gcc.gnu.org
Fri Nov 18 17:40:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51210
Bug #: 51210
Summary: [C++11][DR 547] std::type_info works incorrectly with
function types with cv-qualifier-seq
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: daniel.kruegler@googlemail.com
CC: jason@gcc.gnu.org
gcc 4.7 20111112 (experimental) in C++11 mode outputs
1
in the following program:
//---------------
#include <iostream>
#include <typeinfo>
typedef void FC() const;
int main() {
std::cout << (typeid(void()) == typeid(FC)) << std::endl;
}
//---------------
As of C++11 it has been clarified that FC still contains the information of a
function that has a const qualifier. There is no evidence from 5.2.8 that says
that
void() const
and
void()
should give std::type_info objects that evaluate to equal.
The program should output
0
instead.
In regard to the upcoming implementation for functions with ref-qualifier the
same constraints should hold, i.e.
//---------------
#include <iostream>
#include <typeinfo>
typedef void FLR() &;
typedef void FRR() &&;
int main() {
std::cout << (typeid(void()) == typeid(FLR)) << std::endl;
std::cout << (typeid(void()) == typeid(FRR)) << std::endl;
}
//---------------
should output:
0
0
More information about the Gcc-bugs
mailing list