Googletest export

Update note on static const data members for C++17.

Using `constexpr` provides a tidier solution, where applicable.

PiperOrigin-RevId: 343276402
This commit is contained in:
Abseil Team 2020-11-19 09:13:24 -05:00 committed by Gennadiy Rozental
parent 60b8906d14
commit efe703618c

View File

@ -217,6 +217,18 @@ particular, using it in googletest comparison assertions (`EXPECT_EQ`, etc) will
generate an "undefined reference" linker error. The fact that "it used to work" generate an "undefined reference" linker error. The fact that "it used to work"
doesn't mean it's valid. It just means that you were lucky. :-) doesn't mean it's valid. It just means that you were lucky. :-)
If the declaration of the static data member is `constexpr` then it is
implicitly an `inline` definition, and a separate definition in `foo.cc` is not
needed:
```c++
// foo.h
class Foo {
...
static constexpr int kBar = 100; // Defines kBar, no need to do it in foo.cc.
};
```
## Can I derive a test fixture from another? ## Can I derive a test fixture from another?
Yes. Yes.