For the following code, one has the following:
g++ main.cpp : undefined reference to `X::VAL1'
g++ main.cpp -O3 : links O.K.
----------------------main.cpp------------------------------
struct X { static const int VAL1 = 17; };
int func1( const int aVal ) { }
int func2( const int &aVal ) { }
int main()
{
func1( ::X::VAL1 );
func2( ::X::VAL1 ); //undefined reference to ::X::VAL1 ??
}
--
Summary: static const data members can't be passed to const
reference
Product: gcc
Version: 4.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: m_albert137 at yahoo dot com
GCC build triplet: x86_64-linux-gnu
GCC host triplet: x86_64-linux-gnu
GCC target triplet: x86_64-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38624