mirror of
https://github.com/google/googletest.git
synced 2024-12-28 11:10:44 +08:00
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:
parent
60b8906d14
commit
efe703618c
@ -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"
|
||||
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?
|
||||
|
||||
Yes.
|
||||
|
Loading…
x
Reference in New Issue
Block a user