On Sat, Oct 03, 2009 at 04:25:08PM -0700, Peter Kasting wrote:
> On Sat, Oct 3, 2009 at 11:59 AM, Antoine Labour <[email protected]> wrote:
> > On Sat, Oct 3, 2009 at 11:09 AM, Dan Kegel <[email protected]> wrote:
> >> On Sat, Oct 3, 2009 at 11:07 AM, Dan Kegel <[email protected]> wrote:
> >> >> "undefined reference to
> >> >> BlockedPopupContainer::kImpossibleNumberOfPopups"
> >>
> >> Aha. It's a bug in our code. chrome/browser/blocked_popup_container.cc
> >> needs to follow through and actually declare storage for that variable.
> >>
> >
> > MSVC and GCC differ regarding the C++ spec for when you define a static
> > const in a class.
> > The spec says you need to provide storage for it.
> >
>
> You're missing the point. The pre-existing code already had the existing
> declarations and usage for this variable. I didn't touch that at all. I
> added a DCHECK that referred to it in a function that already referred to
> it, and things broke. I commented out the DCHECK and left all the other
> references and things worked again. This puzzles me.
The other references are all in arithmetic expressions, so I presume they
get the variable access converted to using its immediate value, and don't
reference the variable anymore by link time.
But DCHECK_NE expands to CheckNEImpl, which takes its arguments by
reference, so now the variable has to actually exist (have storage).
(I guess CheckNEImpl's inline isn't kicking in, or if it is, the compiler
isn't following the reference-dereference to see it can just use the
immediate value.)
-- Jacob
--~--~---------~--~----~------------~-------~--~----~
Chromium Developers mailing list: [email protected]
View archives, change email options, or unsubscribe:
http://groups.google.com/group/chromium-dev
-~----------~----~----~----~------~----~------~--~---