error: expected ‘)’ before ‘return’

Hi, I got this error while compiling smtsim.
here is my part of code which gives the error (Actual file is 445 lines and contains a header file). I am getting error___ error: expected ‘)’ before ‘return’ ___ at both of these "if (noexcept)" i.e line 10 and line 26. Can anyone help me out?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
case KVPathComp::Name:
        {
            const string& name = comp.get_name();
            if (!name.empty()) {
                KVTreeVal *child = walk->get_child(name);
                if (child) {
                    if (!(next = dynamic_cast<KVTree *>(child))) {
                        if (all_trees || !is_final_comp) {
                            // All components but the last must be trees
                            if (noexcept)
                                return 0;
                            KVPath child_path = KVParsedPath::full_path(walk);
                            child_path.down(comp);
                            throw KVParsedPath::BadPath(child_path,
                                                        "not a tree");
                        }
                        result = child;
                    }
                } else if (create_missing_trees &&
                           (!is_final_comp || all_trees)) {
                    KVTree *new_tree = new KVTree();
                    walk->set_child(name, new_tree, false);
                    next = new_tree;
                } else {
                    next = 0;
                    if (noexcept)
                        return 0;
                    KVPath child_path = KVParsedPath::full_path(walk);
                    child_path.down(comp);
                    throw KVParsedPath::BadPath(child_path, "not found");
                }
            } 
            break;
        }
Last edited on
What is noexcept?
@helios, I think it is a keyword here, since it is not a variable.
Last edited on
You're right. I was expecting a macro or something.
http://en.cppreference.com/w/cpp/language/noexcept

That's not how the operator is used. What exactly are you trying to say in that if?
Actually, I did not do this code. I was just compiling it for my work, this code was supposed to be correct, since many got the output. It was done by SMTSIM people.

I can paste the whole code. And the header file.
Cannot paste the whole code here, it is too long.
Well, you'll have to ask them to fix it, then. At the very least, tell them your compiler rejects the code and they should tell you what to do to at least get the compiler to behave.
I tweaked a bit and changed noexcept to no_except (may be it is a variable). And that removed the error but have to see whether the program works fine. I was thinking to ask them, after this. Thanks helios.
Topic archived. No new replies allowed.