<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/135012>135012</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Emitting attribute diagnostics twice in some template instantiations
</td>
</tr>
<tr>
<th>Labels</th>
<td>
c++,
clang:frontend,
quality-of-implementation
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
AaronBallman
</td>
</tr>
</table>
<pre>
Consider the following:
```
template <class T>
void f(T __attribute__((align_value(4))) x) {} // expected-warning 2 {{'align_value' attribute only applies to a pointer or reference ('int' is invalid)}}
void foo() {
f<int>(0); // expected-note {{while substituting explicitly-specified template arguments into function template 'f'}} \
expected-note {{while substituting deduced template arguments into function template 'f' [with T = int]}}
}
```
It would be ideal to only diagnose once rather than twice. We get one diagnostic from explicit template arguments and another one for deduced template arguments, which seems silly.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJycVM2OwzYPfBr5QiTwSv5JDj7kZwN89wW-YyBbtM1CllyJTjZvX8jZJi1aFEUBQobhoWY4JK1jpMEhNqI8ivKc6YVHH5qDDt4dtbWTdlnrzaM5eRfJYAAeEXpvrb-TG4Q6iPwgqvwn8gPjNFvNCEKdOqtjhC-hPkV-uHky0Au5-4LrVTMHahfG61XInZA7bWlw15u2Cwq5K4TcPwO-0yHqo6jPIORFyAvg94wdo9ncdXDkBpBPwFHI-k_31PDiAe_sA_Q8W8II7EHD7MkxBvABAvYY0HUIq5qaHKdsikDupi2ZJKY-p8gPr1q8X9FPefkBoBfqlFLVp5C7POWo419EO5_MWfXeR7IIcWkjEy-cSsHv2VJHbB-bOGNHPaGBl6c6DMuEjpMu9tAvrmPy7g0Qsu6FrJ9aQZSnpOtfUhs0S_df2ECUxzvxCF8g1DmBRXl-2_U8_zAi_2O4-8UaaBHIoLapH2t_DOnB-Zi61SEEzeM6cNoB36nDLfwfYUAG7_B3LFMHffDTy7m_06-dAe38el3K7X34h3KFPMF9pG6EiDhFiGTtY5uZRpm92usMm4-6KGRelbsyGxssysrUbVmoWuVKlWpfSKV7o_dd2--rXUaNzGWZF_n-QxX7otxWVS6Loq-7qq12lTGiyHHSZLfW3qatD0NGMS7YfKgy_5CZ1S3auG6olJ2QxzWkkKf0bvW6hn3wjtGZ14dfF22JHxvfb2iaLabSdOpfQpTnLDSJbdMuQxRFbilyfPMzscXmcyJeR-O9Rm_X47MnQA6in_DtI7nI2jGtZDFbgm1G5jmmf8W6CwPxuLTbzk9CXhLlz2MzB_8LdizkZa0_Cnn5seDWyN8CAAD__7R9hc4">