This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/62206] New: Gcc doesn't optimize methods in template class, even when they don't depend on the template variable
- From: "tohava at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 20 Aug 2014 17:05:19 +0000
- Subject: [Bug c++/62206] New: Gcc doesn't optimize methods in template class, even when they don't depend on the template variable
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62206
Bug ID: 62206
Summary: Gcc doesn't optimize methods in template class, even
when they don't depend on the template variable
Product: gcc
Version: 4.8.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: tohava at gmail dot com
Take a look at the following code:
#include <stdio.h>
template <class T>
class C {
public:
static int foobar() { printf("helloworld\n"); }
};
int main() {
C<int>::foobar();
C<double>::foobar();
}
Since olga_rocks is not dependent on the template parameter T, I would expect
gcc to generate only a single version of `olga_rocks`. However, it generates
two identical versions instead, even when compiling with `-O3 -fno-inline`.