Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVisitor.java')
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVisitor.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVisitor.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVisitor.java
index c24d6402b15..4ccbc5f2741 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVisitor.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVisitor.java
@@ -2270,6 +2270,10 @@ public class CPPVisitor extends ASTQueries {
// 'decltype(auto)' cannot be combined with * or & the way 'auto' can.
return ProblemType.CANNOT_DEDUCE_DECLTYPE_AUTO_TYPE;
}
+ if (declSpec.isConst() || declSpec.isVolatile()) {
+ // 'decltype(auto)' cannot be combined with any type specifiers. [dcl.type.auto.deduct]
+ return ProblemType.CANNOT_DEDUCE_DECLTYPE_AUTO_TYPE;
+ }
if (autoInitClause instanceof IASTExpression) {
return getDeclType((IASTExpression) autoInitClause);
} else {
@@ -2392,6 +2396,10 @@ public class CPPVisitor extends ASTQueries {
// 'decltype(auto)' cannot be combined with * or & the way 'auto' can.
return ProblemType.CANNOT_DEDUCE_DECLTYPE_AUTO_TYPE;
}
+ if (autoDeclSpec.isConst() || autoDeclSpec.isVolatile()) {
+ // 'decltype(auto)' cannot be combined with any type specifiers. [dcl.type.auto.deduct]
+ return ProblemType.CANNOT_DEDUCE_DECLTYPE_AUTO_TYPE;
+ }
return CPPSemantics.getDeclTypeForEvaluation(returnEval);
} else /* auto */ {
return createAutoType(returnEval, autoDeclSpec, autoDeclarator);

Back to the top