File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -144,3 +144,22 @@ template <typename>
144144void L::l6 (int = 6 ) {}
145145// expected-error@-1 {{redefinition of default argument}}
146146// expected-note@#l6 {{previous definition is here}}
147+
148+ template <typename >
149+ struct M {
150+ void m1 (int );
151+ void m2 (int = 2 );
152+ void m3 (int = 3 ); // #m3
153+ };
154+
155+ template <typename T>
156+ void M<T>::m1(int = 1 ) {}
157+ // expected-error@-1 {{default arguments cannot be added to an out-of-line definition of a member of a class template}}
158+
159+ template <typename T>
160+ void M<T>::m2(int ) {}
161+
162+ template <typename T>
163+ void M<T>::m3(int = 3 ) {}
164+ // expected-error@-1 {{redefinition of default argument}}
165+ // expected-note@#m3 {{previous definition is here}}
You can’t perform that action at this time.
0 commit comments