Skip to content

Commit 5bde614

Browse files
Merge pull request #4748 from Rageking8/split-code-blocks-for-c2992
Split code blocks for C2992
2 parents 2bb20f8 + 1164aaf commit 5bde614

File tree

1 file changed

+19
-15
lines changed

1 file changed

+19
-15
lines changed

docs/error-messages/compiler-errors-2/compiler-error-c2992.md

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,30 +20,34 @@ The following sample generates C2992:
2020
// C2992.cpp
2121
// compile with: /c
2222
template <class T>
23-
struct TC1 {
23+
struct Outer {
2424
template <class U>
25-
struct TC2;
25+
struct Inner;
2626
};
2727

28-
template <class T> struct TC1<T>::TC2 {}; // C2992
28+
template <class T> // C2992
29+
struct Outer<T>::Inner {};
2930

30-
// OK
3131
template <class T>
32-
template <class U>
33-
struct TC1<T>::TC2 {};
34-
// C2992 can also occur when using generics:
35-
// C2992c.cpp
36-
// compile with: /clr /c
32+
template <class U> // OK
33+
struct Outer<T>::Inner {};
34+
```
35+
36+
C2992 can also occur when using generics:
37+
38+
```cpp
39+
// C2992b.cpp
40+
// compile with: /c /clr
3741
generic <class T>
38-
ref struct GC1 {
42+
ref struct Outer {
3943
generic <class U>
40-
ref struct GC2;
44+
ref struct Inner;
4145
};
4246
43-
generic <class T> ref struct GC1<T>::GC2 {}; // C2992
47+
generic <class T> // C2992
48+
ref struct Outer<T>::Inner {};
4449
45-
// OK
4650
generic <class T>
47-
generic <class U>
48-
ref struct GC1<T>::GC2 {};
51+
generic <class U> // OK
52+
ref struct Outer<T>::Inner {};
4953
```

0 commit comments

Comments
 (0)