[LLVMbugs] [Bug 12104] New: Missing definition for static const member
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Mon Feb 27 15:16:35 PST 2012
http://llvm.org/bugs/show_bug.cgi?id=12104
Bug #: 12104
Summary: Missing definition for static const member
Product: clang
Version: unspecified
Platform: PC
OS/Version: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: C++0x
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: rafael.espindola at gmail.com
CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
Classification: Unclassified
given
------------------------------------------
template <int dimm> struct Patch {
unsigned int patch_index;
Patch ();
static const unsigned int no_neighbor = -1;
};
#ifdef FOO
void foobar(const unsigned &y);
void build_patches () {
foobar(Patch<1>::no_neighbor);
}
#else
template <int dim>
const unsigned int Patch<dim>::no_neighbor;
template <int dim>
Patch<dim>::Patch () : patch_index(no_neighbor) {
}
template struct Patch<1>;
#endif
----------------------------------------------
both clang and gcc in c++11 mode will produce an undefined symbol with -DFOO.
Without it, gcc produces a definition but clang doesn't. To make things really
strange, commenting the Patch constructor definition causes clang to emit the
symbol (_ZN5PatchILi1EE11no_neighborE).
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list