mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
Ambiguity resolution and friends, bug 264109.
This commit is contained in:
parent
93867fa16e
commit
dfb35058dd
2 changed files with 14 additions and 9 deletions
|
@ -3767,8 +3767,10 @@ public class AST2TemplateTests extends AST2BaseTest {
|
|||
// return A<C>(p);
|
||||
// }
|
||||
public void _testForwardDeclarations_264109() throws Exception {
|
||||
BindingAssertionHelper bh= new BindingAssertionHelper(getAboveComment(), true);
|
||||
final String code = getAboveComment();
|
||||
BindingAssertionHelper bh= new BindingAssertionHelper(code, true);
|
||||
bh.assertNonProblem("A<C> make_A(C* p) {", 4, ICPPTemplateInstance.class);
|
||||
parseAndCheckBindings(code, ParserLanguage.CPP);
|
||||
}
|
||||
|
||||
// template <typename T> class CT {
|
||||
|
|
|
@ -2576,6 +2576,16 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
|
|||
}
|
||||
|
||||
private boolean canHaveConstructorInitializer(IASTDeclSpecifier declspec, IASTDeclarator dtor) {
|
||||
if (declspec instanceof ICPPASTDeclSpecifier) {
|
||||
ICPPASTDeclSpecifier cppspec= (ICPPASTDeclSpecifier) declspec;
|
||||
if (cppspec.isFriend()) {
|
||||
return false;
|
||||
}
|
||||
if (cppspec.getStorageClass() == IASTDeclSpecifier.sc_typedef) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (declspec instanceof ICPPASTSimpleDeclSpecifier) {
|
||||
ICPPASTSimpleDeclSpecifier sspec= (ICPPASTSimpleDeclSpecifier) declspec;
|
||||
switch(sspec.getType()) {
|
||||
|
@ -2592,14 +2602,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
|
|||
case IASTSimpleDeclSpecifier.t_void:
|
||||
return false;
|
||||
}
|
||||
|
||||
if (sspec.isFriend()) {
|
||||
return false;
|
||||
}
|
||||
if (sspec.getStorageClass() == IASTDeclSpecifier.sc_typedef) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (dtor != null) {
|
||||
IASTName name = ASTQueries.findInnermostDeclarator(dtor).getName().getLastName();
|
||||
|
|
Loading…
Add table
Reference in a new issue