Skip to content

Commit 901b742

Browse files
jensmaurerzygoloid
authored andcommitted
[dcl.spec.auto] Add example to show variable redeclaration with 'auto'.
CWG2389 Agreement of deduced and explicitly-specified variable types
1 parent eaf2372 commit 901b742

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

source/declarations.tex

+6
Original file line numberDiff line numberDiff line change
@@ -1862,6 +1862,12 @@
18621862
friend T frf(T);
18631863
};
18641864
auto frf(int i) { return i; } // not a friend of \tcode{A<int>}
1865+
extern int v;
1866+
auto v = 17; // OK, redeclares \tcode{v}
1867+
struct S {
1868+
static int i;
1869+
};
1870+
auto S::i = 23; // OK
18651871
\end{codeblock}
18661872
\end{example}
18671873

0 commit comments

Comments
 (0)