language: C++ 4.7.2 (gcc-4.7.2)
date: 728 days 0 hours ago
link:
visibility: private
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <iostream>
 
template<class D>
char register_(){
    std::cout << "Called.";
}
 
template<class D>
struct Foo{
    static char const dummy;
};
 
template<class D>
char const Foo<D>::dummy = register_<D>();
 
struct Bar
    : Foo<Bar>
{
    static char const get_dummy() { (void)dummy; return 42; }
};
 
int main(){}
prog.cpp: In function ‘char register_()’:
prog.cpp:6: warning: no return statement in function returning non-void
prog.cpp: In function ‘char register_() [with D = Bar]’:
prog.cpp:6: warning: control reaches end of non-void function